i have already edited this question, because probably would useful for someone else,and well , my problematics is the next:
I have hundreds of files, 256 to be exact ,this files are .csv, and I need to generate a directory/folder with 50 copies for each file, for example:
-file1.csv---->folder_for_file1---->1copy_file1.csv,2copy_file1.csv,3copy_file1.csv........50copy_file1.csv
-file2.csv---->folder_for_file2---->1copy_file2.csv,2copy_file2.csv,3copy_file2.csv........50copy_file2.csv
-file3.csv---->folder_for_file3---->1copy_file3.csv,2copy_file3.csv,3copy_file3.csv........50copy_file3.csv
...
-file256.csv---->folder_forfile256---->1copy_file256.csv,2copy_file256.csv,3copy_file256.csv........50copy_file256.csv
What can I use to do this ??, some bash script or some simple ubuntu/linux command, like mk dir?
P.D/P.S.The answer that they have provided me, works very well, but I had a problem with the name of the generated folder, because it's name is the extension of the file and it's not useful for me.
thanks in advance
Your requirements are not very clear. I will answer with some assumptions.
For each file named file_i
, suppose you want to create a directory named file_i_folder
for that file under the same path of these files. You can do this via this command:
ls | xargs -t -n1 -i mkdir {}_folder
Then you want to create copies of each files under their corresponding directories. Since the names of files cannot be duplicated, you may want to give prefixes for copies, e.g. copy1_file1
. You can do this via this command:
ls -p | grep -v / | xargs -t -n1 -i bash -c 'for i in {1..50}; do cp {} "{}_folder/copy${i}_{}" ; done'
You can alter the commands to change the format of the names of files and directories at your own will.