In my parent directory I have 78,160 files.
File names are: sb_604_dpm_0089000.dpx, sb_604_0089001.dpx etc.
I want to move the files to 4 sub directories subdir1, subdir2, subdir3, subdir4. There must be exactly 20,000 files in each directory in sequential order.
Is it to possible to move a certain range of files from the parent directory to the sub-directories i.e., sb_604_dpm_0089000.dpx to sb_604_dpm_0108,999.dpx files to subdir1 sb_604_dpm_0109000.dpx to sb_604_dpm_0128,999.dpx files to subdir2 etc.
The final folder will only contain the remaining files after the first 60,000.
All of these should be done using a batch file, ideally being able to specify/check the range before the move proceeds. Is this possible?
In DOS I would probably be able to work this out for myself writing a batch file, but with Linux I'm a little lost... I'm not a programmer, I'm just a linux user looking for faster/better ways to do this rather than the GUI, so any help appreciated. Please keep it as simple as possible!
Thanks in advance!
If it's a one-time task, you could use shell expansion like so:
{1..5}
expands to1 2 3 4 5
, so the above commands expand to the first/second/third 20,000 files, and the last line handles the rest.Something like this little script should do it for you:
Put script into a file inside of the folder with the files you want to move (eg folder in your home folder named "my-files") and name the file "move". Then from the command line: