If you want to move ABC-IDENTIFIER-XYZ.ext
or IDENTIFIER-XYZ.xml
, you can use:
mv *IDENTIFIER* ~/YourPath/
*
is a wildcard for zero or more characters, this means zero or more characters, followed by IDENTIFIER
, followed by zero or more characters.
This will move all the files that contain the IDENTIFIER
you specified.
You can:
- Make your home directory world-readable and writeable.
- Login into his account.
- Move your files to his directory.
- Change ownership of said files.
- Logout of his account.
- Revert permissions of your home directory.
Detailed Step-by-Step Guide
Assume you're becko and you want to move the files to bob's home directory. Thus the paths for your homes are as follows (by default):
becko: /home/becko/
bob: /home/bob/
Now let's say the paths of the files you want to move are as follows:
/home/becko/file_01
/home/becko/file_02
/home/becko/file_03
Now, with this introduction, we can start.
NOTE: This example assumes all relevant files are one level below your home directory.
Step One: Make your home directory world-readable and writeable
While logged in as yourself, open a terminal (Ctrl+Alt+T)
.
Go to your home directory and make it world-readable:
$ cd ~
$ chmod 0777 .
Step Two: Login into his Account
Then, using the example provided above:
$ su - bob
You'll be prompted with his password.
Step Three: Move your files to his directory
After you login, you should see the following prompt (or something close to it):
bob@hellsdesk:~$
Now you are in bob's home directory. Now, time to move your stuff over.
The following commands should do it:
$ mv /home/becko/file_01 .
$ mv /home/becko/file_02 .
$ mv /home/becko/file_03 .
Step Four: Change Ownership of Files:
NOTE: For me, the ownership changed to bob automatically, but might as well be safe than sorry. :)
Commands:
$ chown bob:bob file_01
$ chown bob:bob file_02
$ chown bob:bob file_03
Step Five: Logout of His Account
This one's easy. Type:
$ logout
Your prompt should then change back to something like:
becko@hellsdesk:~$
Step Six: Revert your home directory permissions.
By default, the permissions are 0755. So, we'll do that:
$ chmod 0755 .
Close the terminal and you're done!
Best Answer
You don't need any pipe-ing, and
xargs
to make the filenames as arguments formv
.Just use
mv
within the-exec
action offind
:/destination
with the actual destination directoryfind
will handle all possible filenamesfind
will handleARG_MAX
by passing as many filenames in one go so that does not triggerARG_MAX
-type f
'*.pdf'
, so that shell does not expand them beforehand asfind
will handle themIf for some weird reason, or for learning purpose, you must use pipe-
xargs
: