bash-tutorial/tutorial/move_files.org

37 lines
1.2 KiB
Org Mode

#+options: toc:nil num:nil author:nil
* Move or rename files
Use "~mv~ source destination" command
: mv /home/myuser/text.txt /home/myuser/Documents/text.csv
Example: moving the ".config" files to ".config3", then moving
".config1" to ".config" to arrange configuration archives.
This creates a copy of each file in the same directory
: pwd # check where are you now
: # moving files
: mv file1.txt file3.txt
*Moving multiple files* can be possible. Selecting all the files ending
in ".mp3" within Downloads
: mv ~/Downloads/*.mp3 ~/Music/
*Moving multiple* files included within a text file. Files are included in "filesmv2.txt" and are moved to
"tmpfiles" directory. "t" argument stands for "target directory"
Each line in the "txt" file looks like this:
'/home/user/file1.pdf' # original
: $ cat filesmv2.txt | xargs mv -t ~/tmpfiles
Source: [[https://unix.stackexchange.com/questions/115734/move-file-by-list-in-file-with-leading-whitespace][stackexchange]]
*Moving multiple files* using wildcards. This moves all files containing the sequence "nasa" in the middle of
the name. '*' indicates that there are characters or numbers before and after the word "nasa"
: mv *roco* -t ./direct