Removing duplicate files II

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
tscottme

Removing duplicate files II

Post by tscottme » Thu Aug 07, 2003 6:36 am

I need help writing a script that will remove from the HD only those files that are on the CD.

I have written a batch file that creates a text file with the path\filename of each file on the CD-ROM. I have a script which will count the number of lines in that text file, presumably useful for determing how many times to loop.

A typical entry of the text file is below:
F:\Directory\sub-directory\filename1.mp3

I would like to delete from the HD, regardless of its subdir location, filename1.mp3. I can't just delete the contents of whole subdirectories since that will remove too many files. I don't want to copy the files that are to be burned to CD to other subdirectories.

Can someone offer suggestions?
Thanks,
Scott

tscottme

Removing duplicate files II

Post by tscottme » Thu Aug 07, 2003 6:39 am

Sorry, I forgot to mention I'm using Win98SE and MacroSched 6.2

Lumumba

Post by Lumumba » Thu Aug 07, 2003 3:59 pm

Try to get rid of the file's path which you've found on the CD (extract only the filename). Otherwise you've to extract the filename from that path with Pos> ... :cry:

Code: Select all

Let>CDln=0

Label>CD
Add>CDln,1
ReadLn>CDScan.txt,CDln,CDFilename
If>CDFilename=##EOF##,Done
Run Program> cmd /c dir /s /b /l /w c:\%CDFilename% > c:\HDScan.txt
Let>HDln=0

Label>HD
Add>HDln,1
ReadLn>c:\HDScan.txt,HDln,HDFilename
If>HDFilename=##EOF##,CD
Delete>%HDFilename%
Goto>HD

Label>Done
//Delete>C:\HDScan.txt
//Delete>C:\CDScan.txt
MessageModal>Bye!
Should work ...

tscottme

Post by tscottme » Thu Aug 07, 2003 8:57 pm

Thank you.

Lumumba

Post by Lumumba » Fri Aug 08, 2003 5:44 am

Ooops. :roll:
Cause you use Windows 98, you have to replace cmd with command

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts