AutoHotkey Community

It is currently May 27th, 2012, 12:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: March 25th, 2011, 3:18 am 
Hello, Uberi. Thanks for taking the trouble.

Code wasn't creating files due to formatting,
Code:
FormatTime, ModifyTime, %A_LoopFileTimeModified%, hh-mm-ss tt`_dd-MM-yyyy
fixes the problem. Now it reports sizes on name :D , but even after inserting a "+" after each "FileSetTime, " section I can't clone timestamping on newly created "pseudo-files".
> What's the function of the "tt' " part? Removing it seems to have no impact, but I tested both formats - with and without it.

I was unable to write something like "hh . "h" . -mm . "min" -ss" so I could have "23h24min24" as output, if this is possible fine, otherwise I can live with that as it is.

Is there a way to have a flexible value instead of fixed KB? Like 8 bytes > 999 KB > 10 MB > 1 GB, depending on the size of the source file?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2011, 7:53 pm 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
The "tt" indicates either "AM" or "PM", as the code was using the 12 hour clock.

Regarding your issues with timestamp cloning, I'm guessing that it is probably the "FileSetTime". I've always had troubles with that command in the past, where it would stop working on a seemingly random basis. Not sure what can be done about that.

This version will use a smarter file size display:

Code:
FileSelectFolder, SourceFolder, C:\
FileSelectFolder, DestFolder
MirrorFolder(SourceFolder,DestFolder)

MirrorFolder(SourceFolder,DestFolder)
{
 Units = GB|GiB|1000000000,MB|MiB|1000000,KB|KiB|1000,|Bytes|1
 Loop, %SourceFolder%, 1
  PathLen := StrLen(A_LoopFileLongPath) + 1
 Loop, %SourceFolder%\*, 1, 1
 {
  Path :=  DestFolder . SubStr(A_LoopFileLongPath,PathLen), FileAttributes := FileExist(A_LoopFileLongPath)
  If InStr(FileAttributes,"D")
   FileCreateDir, %Path%
  Else
  {
   FormatTime, ModifyTime, %A_LoopFileTimeModified%, h:mm:ss tt  dd/MM/yyyy
   Loop, Parse, Units, `,
   {
    StringSplit, Temp, A_LoopField, |
    Temp1 := A_LoopFileSize%Temp1%
    If (Temp1 < Temp3)
     Break
   }
   FileAppend,, %Path% (%Temp1% %Temp2%) (Modified at %ModifyTime%)
   MsgBox "%Path% (%Temp1% %Temp2%) (Modified at %ModifyTime%)"
   FileSetAttrib, +%A_LoopFileAttrib%, %Path%
   FileSetTime, %A_LoopFileTimeModified%, %Path%, M
   FileSetTime, %A_LoopFileTimeCreated%, %Path%, C
   FileSetTime, %A_LoopFileTimeAccessed%, %Path%, A
  }
 }
}

_________________
AutoHotkey.net | GitHub

My default license.


Last edited by Uberi on April 10th, 2011, 2:22 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2011, 10:37 am 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
If you use Total Commander as your file manager, there is a plugin called Diskdir which lets you pack any folder you like into a .lst file (basically a zip file containing just the file info). When you click it, it shows the exact structure of the folders you packed, including icons, file sizes, dates and so on.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2011, 1:32 am 
@ArchCarrier
Thanks for the heads up, going after it right now!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2011, 6:11 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
hugov wrote:
If you happen to use Total Commander, there is an addon DiskDir (Extended) that do something similar which can be searched by TotCmd like ZIP files (they are essentially plain text files like a dir /s)
:?: :!: :evil:

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2011, 9:03 pm 
@hugov
Don't be so mad at me... by the time of your post I thought I could have a better result under .ahk, now I am open to any other solution since there are gaps that .ahk may not cover totally, as per what Uberi said.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 9:09 pm 
Uberi wrote:
...

This version will use a smarter file size display:

Code:
FileSelectFolder, SourceFolder, C:\
FileSelectFolder, DestFolder
MirrorFolder(SourceFolder,DestFolder)

MirrorFolder(SourceFolder,DestFolder)
{
 Units = GB|GiB|1000000000,MB|MiB|1000000,KB|KiB|1000,|Bytes|1
 Loop, %SourceFolder%, 1
  PathLen := StrLen(A_LoopFileLongPath) + 1
 Loop, %SourceFolder%\*, 1, 1
 {
  Path :=  DestFolder . SubStr(A_LoopFileLongPath,PathLen), FileAttributes := FileExist(A_LoopFileLongPath)
  If InStr(A_LoopFileAttrib,"D")
   FileCreateDir, %Path%
  Else
  {
   FormatTime, ModifyTime, %A_LoopFileTimeModified%, h:mm:ss tt  dd/MM/yyyy
   Loop, Parse, Units, `,
   {
    StringSplit, Temp, A_LoopField, |
    Temp1 := A_LoopFileSize%Temp1%
    If (Temp1 < Temp3)
     Break
   }
   FileAppend,, %Path% (%Temp1% %Temp2%) (Modified at %ModifyTime%)
   FileSetAttrib, +%A_LoopFileAttrib%, %Path%
   FileSetTime, %A_LoopFileTimeModified%, %Path%, M
   FileSetTime, %A_LoopFileTimeCreated%, %Path%, C
   FileSetTime, %A_LoopFileTimeAccessed%, %Path%, A
  }
 }
}


The smarter code doesnt work for me.
Neither the attributes part.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 9:23 pm 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
What version of AHK? What happens? Does the script run at all? Is it run in a folder that requires additional permissions to access?

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 10:11 pm 
Using AutoHotkey_L_Install.exe
The script runs, but the folders and files seems to not have names correctly named after each measurement unity. Only folders are created and the expected would be to have files and folders cloned at the target directory.
No, operations are run locally by admin under XP.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2011, 10:15 pm 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Could you give an example of a filename that was created?

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2011, 2:16 am 
It's just creating the folders 1:1.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2011, 2:23 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Try rerunning the above code, what does the MsgBox show? Does it work when the MsgBox is removed?

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2011, 7:46 pm 
Tehre's no msgbox in the code?
Run it again with same problem.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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