Results 1 to 4 of 4
hi,
i am running a simulation which outputs files with extension *.foo. a large number of such files (>50k) are generated, and i would like to move them from their ...
- 02-18-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
RESOLVED: batch file move (>50k files) by file extension
hi,
i am running a simulation which outputs files with extension *.foo. a large number of such files (>50k) are generated, and i would like to move them from their current directory to another directory.
i cannot use the usual scripts that make lists because i get the 'argument list too long' error. i think i need to use the 'find' command, with a test for the correct extension, and then a 'mv' command, but i am not familiar enough with the syntax to get it to work. i am going through the bash-scripting guide, but it seems a bit advanced for my purposes...i appreciate any suggestions.Last edited by pagliacci19; 02-18-2009 at 05:15 PM. Reason: RESOLVED
- 02-18-2009 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Here's a find command that should work:
This will just print what the mv commands will look like. There will be a mv command for every file moved. If it looks OK then remove the 'echo' and run again to actually move the files. Refer to the find manpage for details about the options used.Code:find /path/to/source -type f -maxdepth 1 -name "*.foo" -exec echo mv {} /path/to/dest/ \;
- 02-18-2009 #3Just Joined!
- Join Date
- Oct 2004
- Posts
- 62
Hi,
the best solution is to zip all the 50000 files in one compressed file...
Bye.
- 02-18-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
RESOLVED: batch file move for >50k files -- move by extension type
hi -- thanks for the suggestion.
i tried this short while ago and wanted to make certain it worked before posting a reply -- yes, that command works fine.
thanks again!


Reply With Quote