I want to create a directory(File or Folder) reading Csv file in a given path Example as below.
Type Path
Folder C:\Users\PC\Desktop\Test\
File C:\User\PC\Desktop\example.txt
I want shell script to create a file or folder. I don't know where to go for. Please help me. I am new to shell scripting.
You should start by defining your root, say "c:\\users\\pc\\desktop\\"
Next,Traverse through each line of your CSV.
csV_line: C:\Users\PC\Desktop\Testfolder1\testfolder2
replace the root by '' so all that's left is Testfolder1\\testfolder2
You can then split them on \\
Result: Testfolder1 AND testfolder2
Check with a regex or -like ' . ' to see if it has an extension.
Depending on the result you would use new-item -type directory or file .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.