AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File horror (or funny) story

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat
View previous topic :: View next topic  
Author Message
[¤GoO¤]



Joined: 22 Feb 2005
Posts: 60
Location: Sweden

PostPosted: Thu Jun 12, 2008 10:26 pm    Post subject: File horror (or funny) story Reply with quote

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.

Laughing
_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955)
Back to top
View user's profile Send private message Visit poster's website
Slanter



Joined: 28 May 2008
Posts: 259
Location: Minnesota, USA

PostPosted: Thu Jun 12, 2008 10:28 pm    Post subject: Reply with quote

ouch
Back to top
View user's profile Send private message Visit poster's website
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Fri Jun 13, 2008 12:41 am    Post subject: Reply with quote

reminds me of the classic Unix horror story
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Rhys



Joined: 17 Apr 2007
Posts: 721
Location: Florida

PostPosted: Fri Jun 13, 2008 5:33 am    Post subject: Reply with quote

If it's any consolation to you, you have put a smile on my face.
_________________
[Join IRC!]
Back to top
View user's profile Send private message
John W



Joined: 09 Apr 2007
Posts: 169

PostPosted: Fri Jun 13, 2008 4:13 pm    Post subject: Reply with quote

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
_________________
John
Inactive - Until AutoHotkey is available for Linux.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Fri Jun 13, 2008 10:34 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tidbit



Joined: 10 Mar 2008
Posts: 90

PostPosted: Fri Jun 13, 2008 11:59 pm    Post subject: Reply with quote

should I laugh or feel pitty?





*he got owned*
_________________
rawr. be very affraid
Back to top
View user's profile Send private message
Dragonscloud



Joined: 16 Jul 2005
Posts: 96

PostPosted: Sun Jun 15, 2008 9:58 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Mon Jun 16, 2008 6:30 pm    Post subject: Reply with quote

recent relevant post on lifehacker: How to Recover Deleted Files with Free Software
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group