| View previous topic :: View next topic |
| Author |
Message |
[¤GoO¤]
Joined: 22 Feb 2005 Posts: 60 Location: Sweden
|
Posted: Thu Jun 12, 2008 10:26 pm Post subject: File horror (or funny) story |
|
|
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.
 _________________ "Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955) |
|
| Back to top |
|
 |
Slanter
Joined: 28 May 2008 Posts: 259 Location: Minnesota, USA
|
Posted: Thu Jun 12, 2008 10:28 pm Post subject: |
|
|
| ouch |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 721 Location: Florida
|
Posted: Fri Jun 13, 2008 5:33 am Post subject: |
|
|
If it's any consolation to you, you have put a smile on my face. _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 169
|
Posted: Fri Jun 13, 2008 4:13 pm Post subject: |
|
|
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 |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Fri Jun 13, 2008 10:34 pm Post subject: |
|
|
| 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 |
|
 |
tidbit
Joined: 10 Mar 2008 Posts: 90
|
Posted: Fri Jun 13, 2008 11:59 pm Post subject: |
|
|
should I laugh or feel pitty?
*he got owned* _________________ rawr. be very affraid |
|
| Back to top |
|
 |
Dragonscloud
Joined: 16 Jul 2005 Posts: 96
|
Posted: Sun Jun 15, 2008 9:58 pm Post subject: |
|
|
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 |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
|
| Back to top |
|
 |
|