Beginner problem w/ findstr
Posted: 27 Jun 2012 15:25
I apologize in advance if this has been discussed in another post.
My broad problem: I have a directory of audio files. When a file gets updated by an XML software program, the old audio file does not get automatically deleted, which leads to a ton of files sitting around. We need a script that can go in and move these old files out into another folder since we can't alter the software code.
My approach: After much struggles, I managed to get a list of the files in the directory (we'll call it filelist.txt). I was able to use findstr to search the .xml files for any line that looks for one of these audio files and spit that into a list as well (we'll call it xmllist.txt). My goal is to just compare these two lists and find the unique items in the filelist.txt and use that to create a script that will move those files to another directory.
Why I can't get it to work: The xmllist.txt file is spitting out the entire line when it finds a result. I just want it to spit out the file name+extension, but it's got all the other garbage that is on that particular line. This makes it impossible (for me) to compare the two files and get a usable list of unique audio files.
As a work around, I've just been copying the xmllist.txt results into Excel, separating the data and using conditional formatting to find the unique data then make a batch to move the files using that data. However, this process needs to be as automated as possible so that other employees can run it if I get flattened by a bus tonight.
Any help would be appreciated, and remember...I'm a beginner as of 2 days ago. I basically took on this project because I knew more about this than anyone else here.
Thanks a great deal!
My broad problem: I have a directory of audio files. When a file gets updated by an XML software program, the old audio file does not get automatically deleted, which leads to a ton of files sitting around. We need a script that can go in and move these old files out into another folder since we can't alter the software code.
My approach: After much struggles, I managed to get a list of the files in the directory (we'll call it filelist.txt). I was able to use findstr to search the .xml files for any line that looks for one of these audio files and spit that into a list as well (we'll call it xmllist.txt). My goal is to just compare these two lists and find the unique items in the filelist.txt and use that to create a script that will move those files to another directory.
Why I can't get it to work: The xmllist.txt file is spitting out the entire line when it finds a result. I just want it to spit out the file name+extension, but it's got all the other garbage that is on that particular line. This makes it impossible (for me) to compare the two files and get a usable list of unique audio files.
As a work around, I've just been copying the xmllist.txt results into Excel, separating the data and using conditional formatting to find the unique data then make a batch to move the files using that data. However, this process needs to be as automated as possible so that other employees can run it if I get flattened by a bus tonight.
Any help would be appreciated, and remember...I'm a beginner as of 2 days ago. I basically took on this project because I knew more about this than anyone else here.
Thanks a great deal!