Moving 2 months of old files from a folder to another folder.
I need to move huge list of files from april to june to a folder. I need to move without touching July files. Need some help on this. I have used find command.
find . -type f -m time +60 -exec mv /old/files {} \; kindly correct if I am wrong. |
:twocents:
To confirm --- Files created in the month of June was placed by error in the month of April folder as well as July files ? :scratch: If so this should get it done for you. Addjust the periods relative to when you run it as well as the directory paths to what your system reflects. Code:
|
Actually all the april, may, june files are placed in a single folder. There are many folders as well. Only way to distinguish April, May, June files is used date right.. Its a mix of all the months from april - july 11. I need to move all the files except july files to a new folder. Also we need to specify the target location after mv right
find /home/user/Downloads/ -type f -mtime +60 -exec mv /mnt/test {} \; Is this correct.. to move last 60 days of files to /mnt/test... Or would it be simple to move files from april to june alone. What i meant is instead of specifying last 60 days, is there an option to spcecify files from june n april alone |
ls -l | grep -i jul provides me an ouput. I want to move all the listed files to a folder. How can i do it .
|
Code:
ls -l | grep -i jul | awk '{print $6}' > filelist |
I used the below command and it worked
ls -ltr | egrep -v '^d'| /bin/grep Jun | /bin/awk '{ print $9 }' |/bin/cut -d: -f1,2 | xargs -t -I {} mv {} old_files4 |
Quote:
|
All times are GMT -5. The time now is 11:16 AM. |