Operations on multiple folders using a list of paths

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Operations on multiple folders using a list of paths

Post by ineedh3lp » Sun May 08, 2011 4:13 pm

Hello.

Let's say I have this in my clipboard:

Code: Select all

D:\BMachine\zSNAGS\_STRIDER\y2010\y10m01
D:\BMachine\zSNAGS\_STRIDER\y2010\y10m02
D:\BMachine\zSNAGS\_STRIDER\y2010\y10m03
D:\BMachine\zSNAGS\_STRIDER\y2010\y10m04
D:\BMachine\zSNAGS\_STRIDER\y2010\y10m05
A number of paths to different folders.

Assuming I grab the contents of the clipboard to a variable
//Save clipboard paths to variable.
GetClipBoard>folderpaths

What do I have to do in order to operate changes on all folders listed in the saved paths?

It's simple when there's only a single path, but I don't know exactly how to handle multiple paths. I guess it requires an array and a loop.

Could someone help me with the script for achieving this? (for example, setting the read only attribute on each folder listed in the saved paths.. like RunProgram>attrib +R "%folderpaths%")

Thank you!

rohcro
Newbie
Posts: 5
Joined: Tue Apr 26, 2011 2:21 am

Post by rohcro » Mon May 09, 2011 3:07 am

This should work:

Code: Select all

GetClipBoard>folderpaths
Separate>folderpaths,CRLF,path
Let>n=0
Repeat>n
    Let>n=n+1
    Let>p=path_%n%
    RunProgram>cmd /c attrib +R "%p%"
Until>n=path_count

ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Post by ineedh3lp » Mon May 09, 2011 10:45 am

Thank you! It works.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts