The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
read file from tar.gz archive krylin High Level Programming 9 05-20-2009 05:51 PM
read list of filenames from text file and remove these files in multiple directories fxvisions Shell Programming and Scripting 5 08-07-2008 04:59 PM
unzip .zip file and list the files included in the .zip archive oracledev UNIX for Dummies Questions & Answers 5 04-08-2008 05:49 PM
Read file and remove max length mr_bold UNIX for Dummies Questions & Answers 5 01-24-2007 08:51 PM
Read from file then purge or archive. kayarsenal Shell Programming and Scripting 15 08-10-2006 09:24 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-19-2007
fxvisions fxvisions is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 8
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 05:43 PM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0