08-11-2010
Quote:
find $HOME -name /directory/filename | xargs -l rm
The above syntax for "find" will never find any file.
Please post a the full hierarchial name of example files which you wish to find and delete - stating which directory tree(s) to search.
Also, do any of your target filenames or directory names contain space characters?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the following statement in script:
find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN2} -print | while read file; do
...
done
When there are no files located by the find comand it returns:
"find: bad status-- /home/rnitcher/test/....." to the command line
How do I get control in... (3 Replies)
Discussion started by: mavsman
3 Replies
2. Shell Programming and Scripting
I'm using Imagemagick to create thumbnails for a large directory tree. The only thing I can't see is how to get it to write the thumbnails to a "thumbs" subdirectory!
Either of these two commands from the Imagemagick site does most of the job:
find -name '*.jpg' | xargs -n1 sh -c 'convert $0... (5 Replies)
Discussion started by: quixote
5 Replies
3. Shell Programming and Scripting
I want the output of the find command to be printed and also the total files found by it. Can someone help in this.
Obviously $ find . -type f | wc -l will not output the files found but only the count. I want both. There can be millions and trillions of files so dont want the output of find... (3 Replies)
Discussion started by: amicon007
3 Replies
4. Shell Programming and Scripting
Hi,
I am having trouble getting a combination of commands to work.
I need to traverse through all sub-directories of a certain directory and 'cat' the contents of a particular file in the sub-directories.
The commands on their own work but when I combine them I get no output.
The... (4 Replies)
Discussion started by: DownunderDave
4 Replies
5. UNIX for Dummies Questions & Answers
I am trying to delete files older than 60 days from a folder:
find /myfolder/*.dat -mtime +60 -exec rm {} \;
ERROR - argument list too long: find
I can't just give the folder name, as there are some files that I don't want to delete. So i need to give with the pattern (*.dat). I can... (3 Replies)
Discussion started by: risshanth
3 Replies
6. Shell Programming and Scripting
hi,
i've been trying to figure this weird error but I cannot seem to know why. I am using below find command:
find . \( ! -name . -prune \) -type f -mtime +365 -print
The above code returns no file because no files are really more then 365 days old. However, when I use xargs, its... (9 Replies)
Discussion started by: The One
9 Replies
7. Shell Programming and Scripting
Guys i want to run a command to list all directories that havn't been modified in over 548 days ( 1.5 yrs ).
Id like to run a script to first print what the command finds ( so i get a list of the files pre move ... i have a script set for this :
find /Path/Of\ Target/Directory/ -type d -mtime... (4 Replies)
Discussion started by: modulartention
4 Replies
8. Shell Programming and Scripting
I need to apply mp3gain (album mode) to all mp3 files in a given directory. Each album is in its own directory under /media/data/music/albums for example:
/media/data/music/albums/foo
/media/data/music/albums/bar
/media/data/music/albums/more
What needs to happen is:
cd... (4 Replies)
Discussion started by: audiophile
4 Replies
9. UNIX for Dummies Questions & Answers
How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases?
This would seem to involve find, xargs, *grep, regex, etc.
In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Discussion started by: lifechamp
0 Replies
10. Shell Programming and Scripting
Hi, I'd like to ask if anybody can help improve my code to move 1 million+ files from a directory to another:
find /source/dir -name file* -type f | xargs -I '{}' mv {} /destination/dir
I learned this line of code from this forum as well and it works fine. However, file movement is kinda... (6 Replies)
Discussion started by: agentgrecko
6 Replies