Someone had asked a scripting question about how to move all .txt files to their respective parent folders. I can't post an answer there since when I click REPLY, it shows me a blank screen.
Anyway, here are the requirements.
Quote:
|
Start with folder folder1, find files *.txt in the folder and subfolders, move all .txt files back one level up (into parent folder).
|
Here is the script.
Code:
var str list ; lf -rn "*.txt" "folder1" > $list
while ($list <> "")
do
var str file ; lex "1" $list > $file
# $file now has the full path of one file. Strip off the last instance of
# /.../ . If that does not exist in full path, this file is at the top level.
var str parent ; stex -r -p "]^/&/^" $file > $parent
if ($parent=="")
# There is no parent folder to copy this file to.
echo $file " is already at the top-most level directory."
else
system move ("\""+$file+"\"") ("\""+$parent+"\"")
endif
done
This script is in biterscripting (
http://www.biterscripting.com/install.html ) .
Patrick
Recent comments
1 day 9 hours ago
1 day 17 hours ago
1 day 20 hours ago
1 day 21 hours ago
1 day 23 hours ago
2 days 1 hour ago
2 days 2 hours ago
2 days 3 hours ago
2 days 19 hours ago
2 days 20 hours ago