This is my first time asking a question. I am newly trying to use command line more and more but this problem is beyond my skill.
I want to do a multi part file transfer.
1) I want to take multiple files file_1.md
, file_2.md
...etc, from original_folder
and copy them to target_folder_master
2) I want to take each file, create a new folder based on the name of each file, for instance there should be a folder named file_1
etc within target_folder_master
3) I want to be able to copy each file into its correspondingly named folder
4) and then rename each file in its target folder from its original name to index.md
, for instance file_1.md
should be renamed index.md
with final path ~/file_1/index.md
My hope is that this is all automated.
Try this:
for file in *.md; do
mkdir "/path/to/target_folder_master/${file%.*}"
mv "$file" "/path/to/target_folder_master/${file%.*}/index.md"
done
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments