Moving some files
Hello,
There are 4750 files in one of my folder whereas I want to move only 491 files or x number of files. Thanks in anticipation |
I don't think the information you provided is adequate
do you want to move files according to some name convention or the first or last x no. of files? which distro are you using? |
Hi,
Thanks for your reply I am using the mv -f /myFiles/* destinationDir/ All files (4K+) are doc extensions. The task is to move <500 files and then to process them i.e. inserting into database RHE is my OS Best regards |
this will require some sort of script and I am not so good with that but as per my level of knowledge you can try this
Code:
#find /source/directory -type f -size +4K -iname "*.doc" -exec mv {} /destination/ \; |
Thanks for giving me your precious time but not works in my case. Actually your script is looking for 2k or 4k file size whereas I want to move number of files not specific size files.
The problem is all files are same extension i.e. *.doc and the quantity of files is 4K+ Thanks again |
Quote:
Code:
ls| sort -n | head -500| xargs -i mv "{}" /destination |
Sorry!!
|
The command he wrote won't delete anything, it simply moves. Your missing files are located wherever you set the destination, in his example that was /destination
|
Thanks God!! this was really heart attack to loss 5 years data. I found the files but not understand where is the source folder path to move? I can see the destination folder but where I put source folder path?
|
Quote:
Quote:
And I'm not sure how 'precious' that data is, if you haven't bothered to back it up, so you won't lose any of it. Before you start spouting off about "to hell with you", try putting some effort into looking things up on Google, or coming up with your OWN solution. |
I believed this is beginners forum and I am really sorry for the words I wrote earlier. Anyways I removed.
Furthermore, Thanks for your cooperation |
Before running any script in which you don't have 100% confidence, you should stick an "echo" in front of any command that actually does something potentially dangerous, eg:
Code:
ls| sort -n | head -500| xargs -i echo mv "{}" /destination |
Thanks to all from the bottom of my heart particularly TB0ne and suicidaleggroll
Best regards |
Quote:
|
All times are GMT -5. The time now is 04:04 AM. |