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
Removing duplicate files II
Moderators: JRL, Dorian (MJT support)
Removing duplicate files II
Sorry, I forgot to mention I'm using Win98SE and MacroSched 6.2
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> ...
Should work ...

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!