Lets say I have a directory with the following files:1.txt 2.txt 3.txtI want to copy these and basically paste in the same directory making new files eg:1.txt 1(1).txt 2.txt 2(1).txt 3.txt 3(1).txtThis is harder than I thought! This seems trivial on Windows, just highlight a bunch of files, copy/paste, and it creates the same files but adds 'Copy' into the name.
Create copies of files in same directory
shell;cp
In plain Unix style youd need to loop over the files:for file in 1.txt 2.txt 3.txt; do cp -pi $file ${file%.*}(1).txt; done${file%.*} removes the extension from the filename, then (1).txt adds the number and restores the extension. The options to cp prompt if a target already exists (-i) and preserve permissions (-p).Most Linux systems will have the mmv package available; that allows you to simply domcp '*.txt' '#1(1).txt'This copies every file ending in .txt to a new file, matching the first wildcard (#1) and appending (1).txt. The parentheses dont need escaping here because theyre within quotes.Alternatively, if you use a graphical file manager, you can do exactly the same as you would in Windows.