I was moving only the file names in a text file which was working using:
cd /data/sources/
find $PWD -type f -name "Asset_*">> /data/processing/asset_files.txt
But, I also need to:
- Move
Asset_*
files also in/data/processing/
. - Move first 1000 files into
/data/processing/
.
How do I add these two things?
You're on the wrong track, wanting to copy/move 1000 entries. You seem to have a lot of
Asset_*
files (over 1000) and by limiting the number to 1000, you want to check if the behaviour is right and then do it for the whole bunch.Although this seems correct, the limiting to 1000 is quite a burden and will make your script complicated for no purpose.
I'd propose another approach : imagine you have filenames like this:
Then, you might first try to do you thing, using
Asset_0000*
, and then, once you've verified everything is correct, do it for allAsset_*
files.As far as the moving is concerned, you can do this as follows:
Refactoring answer of @Dominique you can use find command and move the files. THis can take a lot of time (depend of number of files) And the command is like:
If you want to move exactly 1000 files you can do it with something like