Jump to content
Sign in to follow this  
speedi

filemove resulted in folder types being changed

Recommended Posts

speedi

I mistakenly used "filemove" instead of "filecopy" on some files and sub folders in mydocs. The result was deleted source data and the destination folders are not "file folder" types. Their properties show type being "file" and the have no extension (as folders do not). The destination size indicates the data (files) might be there. Is there any way to change the file type for my folders back to "file folder"? Can it be done via the registry or some software tool? Thanks for helping! Dumb and Dumber needs help badly!!!

Error script was this:

#include <File.au3>

$srcFolder = @MyDocumentsDir ; Folder you wish to copy

$desFolder = @HomeDrive & "\backup" ; Folder you wish to move files to

$aFiles = _FileListToArray($srcFolder)

For $i = 1 To 400

FileMove($srcFolder & '\' & $aFiles[$i], $desFolder & '\' & $aFiles[$i], 9)

Next

Edited by speedi

Share this post


Link to post
Share on other sites
Richard Robertson

You could try using DirMove to move the "files" back to directories.

(Honestly I have no idea how they are considered files now.)

Edited by Richard Robertson

Share this post


Link to post
Share on other sites
speedi

You could try using DirMove to move the "files" back to directories.

(Honestly I have no idea how they are considered files now.)

tried dirmove and dircopy the file type remained "file"

Share this post


Link to post
Share on other sites
Richard Robertson

I don't know.. You might try a file recovery solution.

Share this post


Link to post
Share on other sites
GEOSoft

Before you use that drive too much, download and use Recuva. Recover the files to anoother drive if you have one.

Next step:

Did those files all have the same extension? If so, rename them using FileMove(). If you need a script for that part let us know. You will want to remember to use the FileGetAttrib() part of the code I used in your other post.

If StringInStr(FileGetAttrib($sFile), "D") Then
    If FileExists($sFile & "\*") Then
        Continueloop
    Else
        ;; Here is where we can handle the rename
        ;; I think we are probably going to want to look at file dates here too so try to remember when this happened
        ;; or get if from the properties of one that messed up
    EndIf
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
FaT3oYCG

Lol, this is why we create test scripts and environments before we make the actual finished implementation XD.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
speedi

Before you use that drive too much, download and use Recuva. Recover the files to anoother drive if you have one.

Next step:

Did those files all have the same extension? If so, rename them using FileMove(). If you need a script for that part let us know. You will want to remember to use the FileGetAttrib() part of the code I used in your other post.

If StringInStr(FileGetAttrib($sFile), "D") Then
    If FileExists($sFile & "\*") Then
        Continueloop
    Else
        ;; Here is where we can handle the rename
        ;; I think we are probably going to want to look at file dates here too so try to remember when this happened
        ;; or get if from the properties of one that messed up
    EndIf
EndIf

I tried recuva with no success.. Recuva finds deleted files and these files were not deleted... I believe they were copied folder and contents to the destination, but the folder type was lost... You can understand better if you try it on your own PC... use any source folder with sub folders that have files and any test destination.... Thanks for taking the time if you can!

#include <File.au3>

$srcFolder = @MyDocumentsDir ; Folder you wish to copy

$desFolder = @HomeDrive & "\backup" ; Folder you wish to move files to

$aFiles = _FileListToArray($srcFolder)

; I used 400 to limit the time since mine had more than 400

For $i = 1 To 400

Filecopy($srcFolder & '\' & $aFiles[$i], $desFolder & '\' & $aFiles[$i], 9)

Next

Edited by speedi

Share this post


Link to post
Share on other sites
FaT3oYCG

I suggest that you don't try this out on your windows folder :D.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
speedi

I've encountered this situation before when I was doing some script debugging.

Your new files are actually the first file that was in the folder minus the extension. If you add the extension back (use TrIDNet to identify them if necessary), you will have that file again.

Unfortunately, the rest of the files that were in the folder have been lost. You may be able to recover them with Recuva (or a similar program), but I wouldn't count on it.

Yes, you are exactly right. I confirmed that the files (that were folders) are indeed one of the files from the source folder. I did a one day old restore to the original folders and then compared the bad folder/file size and in 5 different folders found a file size that matched exactly.... I also loaded those that I thought were text into textpad and I could see the data from the file... Thanks for your input... I am normally careful about running others scripts, but I was not careful enough with this one... I wanted copy and the script used move and I missed it.. Cost me 6 hours... Bummer!

Share this post


Link to post
Share on other sites
GEOSoft

A deep scan with Recuva gets more than just deleted files. It even gets files that were lost during an accidental format. In one recent case I used it successfully to recover all the files on a drive that lost it's file system. What was a NTFS drive started showing up in the management console as being RAW. Every file was recovered and many of them more than once, those ones were deleted versions of the same file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
FaT3oYCG

Well that wasn't so Speedi now was it, I actually had this problem before once but I was using copy and some files and folders that I have made specifically for the task of testing, always be cautios it pays.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.