Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Find anything and open it with one command' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Find anything and open it with one command
Authored by: fracai on Apr 14, '05 03:40:44PM
the following will find all files in the current directory to the directory above the current.
files in directories below the current will not be affected and will print errors.
find ./ -type f -exec mv {} ../{} \;

---
i am jack's amusing sig file

[ Reply to This | # ]

Find anything and open it with one command
Authored by: oink on Apr 14, '05 11:09:37PM

Thank you for trying, but that doesn't solve the problem. That command will move the found files to the parent of the current working directory (./) not the parents of the found files. Example move /dir1/dir2/dir3/file to /dir1/dir2/file

---
blurred visionary



[ Reply to This | # ]
Find anything and open it with one command
Authored by: kps on Apr 15, '05 07:06:37PM
find . -type f -execdir mv {} .. \;

[ Reply to This | # ]
Find anything and open it with one command
Authored by: oink on Apr 16, '05 08:37:00AM

THANK YOU. I learned about execdir from the man page, but it didn't work for me as expected, your example works perfectly. Gotta remember that.

---
blurred visionary



[ Reply to This | # ]