General discussion

Locked

Removing Directories using Command Line

By rvan ·
Can you delete a directory by using a wild card operator or do you have to type the exact name of the directory. For example I have many directorys every week that a program creates which all include the string .lnk such as hello.lnk. I want to use this uniqueness to delete many directories with the same string included in them.

Thanks
Roland

This conversation is currently closed to new comments.

10 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Removing Directories using Command Line

by khuyser In reply to Removing Directories usin ...

Unfortunately you'll have to type the exact name, as wild card characters do not work when using the rmdir command (rd is the short version).

Collapse -

Removing Directories using Command Line

by rvan In reply to Removing Directories usin ...

Poster rated this answer

Collapse -

Removing Directories using Command Line

by OTL In reply to Removing Directories usin ...

No, because DOS uses the hexadecimal value to rmdir and mkdir.

A work around would be to do a DIR > (temporary text file)
Import into excel to get all .INK <DIR> separated from regular files, add a string in front of the path.
Save the text file.

If there are files in these directories;
Reopen in Word and replace the front end string and tab with "DEL " then replace tab and <DIR> with " *.*" then replace all tab with "." and save as a .BAT run this .BAT file to erase all files in the .INK directories

Reopen in Word and replace the front end string and tab with "rmdir " then replace tab and <DIR> with " " then replace all tab with "." and save as a .BAT, run the .BAT file.

Sorry long and slightly involved process, but the only work around I know of for DOS.

For Windows, open primary directory these sub-directories are in and index by file type, high-light the first then go to the bottom, hold the shift key and click on the last one, hit the delete key.

Best I can come up with,

Good Luck!

Collapse -

Removing Directories using Command Line

by OTL In reply to Removing Directories usin ...

Creating the .BAT files will work if the directory names are always the same, then call the .BAT files at preset intervals (DAILY, WEEKLY, MONTHLY). If the file or directory does not exist, no problem. When new DIR's appear add another line to clearand remove that directory, continously.

Collapse -

Removing Directories using Command Line

by rvan In reply to Removing Directories usin ...

Poster rated this answer

Collapse -

Removing Directories using Command Line

by mike In reply to Removing Directories usin ...

There is a batch file that I had somewhere that would pipe the directories to a text file then use the text file to do a recursive delete followed by a rd to do what you need. I'll let you know if I find it.

Collapse -

Removing Directories using Command Line

by rvan In reply to Removing Directories usin ...

Poster rated this answer

Collapse -

Removing Directories using Command Line

by mike In reply to Removing Directories usin ...

There is a batch file that I had somewhere that would pipe the directories to a text file then use the text file to do a recursive delete followed by a rd to do what you need. I'll let you know if I find it.

Collapse -

Removing Directories using Command Line

by rvan In reply to Removing Directories usin ...

Poster rated this answer

Collapse -

Removing Directories using Command Line

by rvan In reply to Removing Directories usin ...

This question was closed by the author

Back to Windows Forum
10 total posts (Page 1 of 1)  

Related Discussions

Related Forums