AutoHotkey Community

It is currently May 26th, 2012, 7:58 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: June 12th, 2008, 10:26 pm 
Offline

Joined: February 22nd, 2005, 7:42 pm
Posts: 60
Location: Sweden
It began with a friend of mine asking for a script to clean out some jpg, txt and other files from his My Documents-folder.
I proceed with writing the following:

Code:
ext = txt,jpg,gif,m3u

loop, parse, ext, `,
   loop, %A_myDocuments%\*.%A_loopfield%,,1
      filedelete, %A_loopfilelongpath%


I send it to him. He then changes his mind and only wants it to clean out his My Music-folder. So he surprises me with pointing out that he can change A_myDocuments to A_mymysic. Didn't know that variable, but trusting my friend I said OK. He proceeds with running it...

He then proceeds with running it...

Can you guess what happens?

He comes screaming back to the conversation telling me that it removed every single txt, jpg, etc file on his computer!

So how did this happen?
Well, since A_mymusic didn't exist, the script for some reason decided to walk back to C:\ and loop everything from there.

:lol:

_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 12th, 2008, 10:28 pm 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
ouch


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 12:41 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
reminds me of the classic Unix horror story

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 5:33 am 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
If it's any consolation to you, you have put a smile on my face.

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 4:13 pm 
Offline

Joined: April 9th, 2007, 4:43 pm
Posts: 172
Because the variable doesn't exist, it's replaced with an empty string. In a path this causes the folder in A_WorkingDir to be used... - Funny

_________________
COMPLETELY INACTIVE - I do not use AHK anymore.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 10:34 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
John W wrote:
In a path this causes the folder in A_WorkingDir to be used...
Actually, in this case the path would begin with "", which indicates the root of the current drive.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 11:59 pm 
Offline

Joined: March 10th, 2008, 12:55 am
Posts: 1907
Location: Minnesota, USA
should I laugh or feel pitty?





*he got owned*

_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
"I think Bigfoot is blurry, that's the problem. It's not the photographer's fault, Bigfoot is blurry. So there's a large, out-of-focus monster roaming the countryside."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 15th, 2008, 9:58 pm 
Offline

Joined: July 16th, 2005, 11:39 am
Posts: 96
Too busy to look them up, since I'm just about to go to work, but there are a couple file recovery freewares out there that aren't too bad. I hope you told him to leave the computer off so the files don't get overwritten or chopped into useless frags.

If Undelete in DOS supports wildcards, that might work, too, but I haven't tried it so I don't know for sure.

_________________
“yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2008, 6:30 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
recent relevant post on lifehacker: How to Recover Deleted Files with Free Software

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group