The structure of my files is as follows:
My_Files:
|-- Folder_1:
| |-- a.txt
| |-- b.txt
| |-- c.txt
|
|-- Folder_2:
|-- a.txt
|-- b.txt
I have about 200 folders like this.
What I Want:
I want to copy my files and rename files of the same name into one folder such as this:
Final_Folder:
|-- a.txt
|-- b.txt
|-- c.txt
|-- a1.txt (Renamed)
|-- b1.txt (Renamed)
What I did:
I used from this command but no result found:
find My_Files/ -type f -print0 | xargs -0 cp -t Final_Folder/
and the output is as follow:
cp: will not overwrite just-created 'Folder_1/a.txt' with 'Final_Folder/a.txt'
cp: will not overwrite just-created 'Folder_1/b.txt' with 'Final_Folder/b.txt'
cp: will not overwrite just-created 'Folder_1/c.txt' with 'Final_Folder/c.txt'
cp: will not overwrite just-created 'Folder_2/a.txt' with 'Final_Folder/a.txt'
cp: will not overwrite just-created 'Folder_2/b.txt' with 'Final_Folder/b.txt'
How can I reach my goal?
Thanks in advance.
find My_Files/ -type f -exec cp -t Final_Folder --backups=numbered {} +
do something close enough to what you want?