03-19-2007
8,
0
Join Date: Mar 2007
Last Activity: 30 October 2007, 5:24 PM EDT
Posts: 8
Thanks Given: 0
Thanked 0 Times in 0 Posts
read list of filenames from text file, archive, and remove
I posted a week ago regarding this scripting question, but I need to revisit and have a few more questions answered..
User cfajohnson was extremely helpful with the archive script, but clarification on my part is needed to help steer the answer in a direction that works in this particular production environment.
The basics:
I have a large list of filenames, running in the thousands, with varying extension types....these extensions and . were pruned from this list, strictly just filenames now, ex., "filename.psd" has been changed to "filename"
The need:
To search through our production server traversing through multiple directory trees and to archive these files, each file size ranging anywhere from 200 KB to 200 MB with different file extensions such as .psd, .eps, or nothing at all, keeping in mind that directory structure in the archive is not necessary, only the file itself as a backup in one archive directory. Once backed up on DVD, etc., this file list can then be read from again and used to delete all files on the server traversing through multiple directory trees while maintaining directory structure and any other files inside these directories that do not match the file list being used.
The catch:
Having some trouble executing scripts, even simple ones such as:
#!/bin/bash
# script to list files and permissions, name: listFiles
ls -l
The permissions were changed to execute the file, i.e.,
chmod +x listFiles
...however, after attempting to execute the file at the command line by simply typing listFiles (I also tried typing $listFiles), bash returns with:
-bash: listFiles: command not found
Perhaps my permissions as admin or user are incorrect? or my path to /bin/bash needs to include a full path back through my permissions tree as a user?
Also, thank you to users srikanthus2002 and jacoden with:
find / -type f -name "fil*" -exec rm {} \;
however, is "fil*" actually READING the list provided in the file and using that list to feed or pipe into -exec rm {}, or strictly looking for the filename of the list file and deleting the list file?
Thanks for your help!
Last edited by fxvisions; 03-19-2007 at 06:43 PM..