One question, How can you select multiple directories ...

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Trast
Junior Member
Junior Member
Posts: 64
Joined: 2011-12-18, 15:32 UTC

One question, How can you select multiple directories ...

Post by *Trast »

How to select multiple directories with one containing a special file?

For example, a file called Auto.txt are several directories and I can search for the file,
but want to delete all the directories or move folders with all content.
/Trast

Excuse my bad English and spelling. ;-)
User avatar
Valentino
Power Member
Power Member
Posts: 709
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

There's no easy way for this in TC.
If number of such folders is small then it's easier to do this manually one by one.
If number of such folders is big then it's easier to write script for this:

1. Find your file (Auto.txt) and press Ctrl+C directly in Find Files window to copy the list to clipboard.
2. Paste in text editor and replace {\Auto.txt} with quote {"}. Then insert {rd /s /q "} in the beginning of each line. For example, if you have the list
c:\folder 1\folder 2\folder 3\Auto.txt
c:\folder 1\folder 2\folder 4\Auto.txt
c:\folder 1\folder 2\folder 5\Auto.txt
c:\folder 1\folder 6\Auto.txt
c:\folder 1\folder 7\Auto.txt
c:\folder 8\Auto.txt
c:\folder 9\Auto.txt
you should get
rd /s /q "c:\folder 1\folder 2\folder 3"
rd /s /q "c:\folder 1\folder 2\folder 4"
rd /s /q "c:\folder 1\folder 2\folder 5"
rd /s /q "c:\folder 1\folder 6"
rd /s /q "c:\folder 1\folder 7"
rd /s /q "c:\folder 8"
rd /s /q "c:\folder 9"
This can be automated using Find and Replace function and regular expressions of your text editor.
3. Save this to "doit.bat" and execute. Note this will remove these folders with all the contents. Is it what you want?
User avatar
Trast
Junior Member
Junior Member
Posts: 64
Joined: 2011-12-18, 15:32 UTC

Post by *Trast »

Thank you very much Valentino, :D it was exactly what I wanted to do. :D
/Trast

Excuse my bad English and spelling. ;-)
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

After all

Post by *Phred »

After all these years I find another gem.

Ctrl+C in the result list copies the result of a Find Files operation to the clipboard. And from there you can make a batch file or the like.

How did I confirm this?:
1. tried it
2. checked the help file for Searching files - and even though Help appears to have no find function itself, it does: Ctrl+F in the text panel and I searched for Ctrl+C, and there it's been, all this time.
User avatar
Valentino
Power Member
Power Member
Posts: 709
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

Ctrl+C also works in many other places :)
For example, in Overwrite dialog.
In Synchronize Directories for selected (highlighted) rows; then you can paste it to Excel for example.
And in any Windows message box.
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Wow

Post by *Phred »

Most impressive, Valentino. I hope it's in the wiki...
Regards, PhredE
Post Reply