Skip to content
Advertisement

Make directory structure from forward slashes

Im pulling an html document from a windows machine onto my linux box and the issue is the directory structure is not maintained between the two. This is how it looks in linux

MyReportpartition_and_timing.filesimg0.jpg
MyReportpartition_and_timing.html
MyReportprotocols_cards.html
MyReportreport_title.filesimg0.jpg
MyReportreport_title.html
MyReportscripts.html

Im thinking of using a bash script that will change the “” into a “/” essentially making a folder. Im guessing their is a standard way of doing this but cannot figure it out.

This is what Im working with

for file in *; do mv $file echo $file | sed 's/\///g' ; done

Advertisement

Answer

try mv $file ${file//\//}. it substitutes each backslash with a forward slash in ${file}.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement