| |

VerySource

 Forgot password?
 Register
Search
View: 1233|Reply: 11

How to call a stored procedure in SQL to delete a directory. . The directory contains files?

[Copy link]

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-10 14:00:01
| Show all posts |Read mode
EXEC XP_CMDSHELL 'DEL D:\A\*. *' This command returns to ask whether to delete

EXEC XP_CMDSHELL 'DEL D:\A\*. * / Y' This is also wrong!

EXEC XP_CMDSHELL 'RD D:\A' Delete empty directory and execute


Please master how to delete the entire directory, including the files inside
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-1-11 19:09:01
| Show all posts
delete tree D:\A
Reply

Use magic Report

0

Threads

20

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-1-13 13:36:01
| Show all posts
del tree
Reply

Use magic Report

0

Threads

66

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-13 14:09:01
| Show all posts
1st floor right ~
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-15 16:36:01
| Show all posts
upstairs
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-17 14:00:01
| Show all posts
There doesn't seem to be a good way. Deltree is not available in all systems. It is not available in 2000. It is not known in 2003.
Reply

Use magic Report

0

Threads

30

Posts

25.00

Credits

Newbie

Rank: 1

Credits
25.00

 China

Post time: 2020-1-18 11:18:01
| Show all posts
That's it
EXEC MASTER..XP_CMDSHELL 'RD D:\A\/ S / Q'

/ S includes subdirectories
/ Q does not require confirmation
Reply

Use magic Report

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-18 11:36:01
| Show all posts
No, the returned result is:

 'deltree' is not an internal or external command, nor is it a runnable program
 Or batch files.
 NULL

Is there any other way? ? DELTREE I have tried it, no
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-18 17:36:01
| Show all posts
--try

exec master: .xp_cmdshell 'RD D:\A / S / Q'
Reply

Use magic Report

0

Threads

8

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-19 23:00:02
| Show all posts
exec master..xp_cmdshell is very strong, just like dos learned in our school
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list