How to move files from a subdirectory to another?
File structure:
/temp/ /temp/testdir1/ /temp/testdir2/ /temp1/ I'm trying to move files in /temp/testdir1 and /temp/testdir2 to /temp1. When I use the command 'mv /temp/*.* /temp1', only the files in /temp/ are moved, but the subdirectories testdir1 and testdir2 are not moved to /temp1. Any help would be deeply appreciated! Thanks. |
hi
try mv -R /temp/*.* /temp1 or mv -r /temp/*.* /temp1 cant remember if its capital R or not |
I get invalid option for both -r and -R.
Quote:
|
Code:
mv -R /temp/ /temp1/ Code:
mv temp temp1 |
From your description, it sounds like you want to execute two separate commands:
mv /temp/testdir1/* /temp1/ mv /temp/testdir2/* /temp1/ Although, this could be combined as "mv /temp/testdir1/* /temp/testdir2/* /temp1/" Look through the man page for "mv". There is no -r or -R option. You are thinking of the "cp" command. If you want to move just files, and not subdirectories, then you will want to use the "find" command. find /temp/testdir1 -maxdepth 1 -type f -exec mv '{}' /temp1/ \; find /temp/testdir2 -maxdepth 1 -type f -exec mv '{}' /temp1/ \; If there are only the two subdirectories testdir1 and testdir2, then the single command find /temp/ -maxdepth 2 -type f -exec mv '{}' /temp1/ \; would work. |
All times are GMT -5. The time now is 01:29 AM. |