topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 4, 2024, 7:49 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: DONE: Change (sub) folder(s) date based on newest/oldest file in the folder  (Read 144411 times)

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

I have looked a *lot* of 'attribute changers/date changers', but have not found one that can change the parent folder date based on the newest or oldest file in that folder.
When adding/deleting a file to a folder,  the folderdate changes. Same goes for unzipping a file to a folder (new folder created).

Basically this is correct, but not often desired (e.g. when comparing folders with backups), or sorting on folderdates.

There are quite a lot requests for this (search on: set folder date newest file), but there is no userfriendly solution.
Possible solutions maybe scripting and using Powershell, etc.

File/Folder Date Organizer does not have this feature, maybe a new feature to this program?

Thanks
=



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
SetFolDate v0.3.1.5
  • Fixed: Wasn't properly migrating date when recursion was active.

There are two executables in the archive, one for Windows Explorer, (SetFolDate.exe), and one for file managers, (SetFolDateFM.exe) - they are not interchangeable.

To install the Explorer version, copy SetFolDate.exe it where you want it to reside and run it.  Click Install and it will be added to the context menu for folders - Done!
If you choose Install (No GUI), then an extra context menuitem will be created that when chosen does NOT open the GUI - it will use the last saved options.
To uninstall, run it again and choose Remove.
NOTE: You may need to use Run as Administrator if you have UAC enabled.


The file manager version accepts the following arguments: SetFolDateFM.exe [/r] <source path> <folder 1> <folder 2> ... <folder n>
Where: [/r]               = Tells it to run without showing the GUI
           <source path> = parent folder of the selected folders
           <folder n>      = list of folders, (sans parent path), separated by a space, (quoted if needed)

eg. Parent folder:     C:\Windows
     Selected folders: Help inf Logs "Offline Web Pages"

If you copy it somewhere and run it, it will generate a DOpus User Command on your Desktop which you can import into DOpus.

See dcwul62's post on adding to the DOpus filetypes so that it won't show up under Explorer.


Interface is self-explanatory:

2014-01-28 14_11_17.png

Left side is the date you want to set for the folder, right side is the date to use from either the oldest or newest file in that folder.  You can choose to recurse through the folder in which case the sub-folder date will be set from the appropriate file within that sub-folder.

Date Limit tells it to ignore files that have a date earlier than 01-Jan-1980 which Explorer can't display but other file managers can.
« Last Edit: July 01, 2015, 03:23 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Thanks for the feedback!

But eh .. . ?? 
Sorry I am not a programmer or so.   

What do I have to do?   :huh:

"SetFolDate <folder> </o|/n>"  where?

How to execute the script?

=


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
No longer valid, see here.

Open a CLI, (DOS prompt), and use the executable, (in the attached archive).

eg.

C:\> SetFolDate.exe R:\test /n
« Last Edit: September 04, 2013, 02:15 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

where do I get the .exe from?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
It's attached to my first post in a 7zip archive.

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Oops! Sorry ...  :-[
I overlooked that.

By the way, would it not be possible to rightclick on a folder, run setfoldate.exe /n from the contextmenu?
i.e. avoiding running from the dos-prompt?

=

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
NOTE: This is all redundant due to new version.

By the way, would it not be possible to rightclick on a folder, run setfoldate.exe /n from the contextmenu?
i.e. avoiding running from the dos-prompt?

What is it with you young people?

Don't you like typing?

 ;D

Code: Text [Select]
  1. REGEDIT4
  2.  
  3. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest]
  4. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest\command]
  5. @="\"x:\\xxxxxxxxxx\\SetFolDate.exe\" \"%1\" /n"
  6. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest]
  7. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest\command]
  8. @="\"x:\\xxxxxxxxxx\\SetFolDate.exe\" \"%1\" /o"

Save the above as SetFolDate.reg and then edit it to point to where you've put SetFolDate.exe, for example:

@="\"x:\\xxxxxxxxxx\\SetFolDate.exe\" \"%1\" /n"

becomes

@="\"C:\\path\\to\\SetFolDate.exe\" \"%1\" /n"

if SetFolDate.exe is in directory C:\path\to

DO NOT change anything other than the drive and path and take note that any \ within the path needs to become \\ as per example.

Save the changed SetFolDate.reg and then double-click on it, when it asks if you want to merge the key, click Yes.

You now have two new context menu items for directories.

2013-08-25 17_28_30-.png

I've updated the archive to include the .reg file.

Got an idea for another version.
« Last Edit: September 04, 2013, 02:16 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Sorry for the delay, I'll get back to you soonest, will be out for a couple of hours.

Oh, by the way, I started with Commodore C64 and later a Commodore PC10 with 2x 5.25" floppy drives.
Think it was 1987. Later I bought a 20MB Seagate (at roughly usd.1350 at the time).
So, not so young anymore...   :(

=


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Oh, by the way, I started with Commodore C64 ....

Bah! 64k RAM? Too easy.

Vic20 for me and only AU$1500 for the C1540 Floppy drive - OMFG, what a lot of money I've wasted on computers  :-\

Anyway, back to the topic in hand....

SetFolDate v0.3.0.6
« Last Edit: September 04, 2013, 02:17 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
This looks really really  won-der-ful !!

Thank you soo much!
This is quite a unique tool!

When the installer is used, can I then tell where it should be installed?
Based on the earlier version (I was not yet aware of this new release, as I am reading it just now) it would be:

F:\SetFolDate

and with below registry-patch

//
Code: Text [Select]
  1. REGEDIT4
  2.      
  3. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest]
  4. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest\command]
  5. @="\"F:\\SetFolDate\\SetFolDate.exe\" \"%1\" /n"
  6. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest]
  7. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest\command]
  8. @="\"F:\\F:\SetFolDate\\SetFolDate.exe\" \"%1\" /o"

//

By the way, I always check downloaded files for viruses. Sorry, really no offence meant!
That is what I always do, with any tool.  Pls donot take this personally, okay..??

I do appreciate all the work!

GData and Bitdefender reported: Gen:Trojan.Heur.AutoIT.1
My Norton Internet Security did not report anything, nor my Kaspersky Internet Security, nor AVG Free.

What do you think?

Maybe it is nothing to worry about.

Again, pls donot take it personal!

Thanks again.
=

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I'll jump in here since this is a pet peve of mine:

When you see a malware scanner report something like:
GData and Bitdefender reported: Gen:Trojan.Heur.AutoIT.1

That's it's way of telling you: "I AM A STUPID LAZY IRRESPONSIBLE MALWARE SCANNER"

The signs are there, you just have to know how to read the detection report.

You can tell by the name it's giving the detection, that "HEUR" means "HEURISTIC", in other words, a guess, a generic thing it found that it doesn't know what it's looking at.

And then the "Heur.AutoIT" is the final nail in the coffin.  What it's basically reporting is that this tool was made with the AutoIt language, AND NOTHING MORE.

So basically this irresponsible lazy stupid malware company is deciding that it's just going to mark EVERY tool on the planet created with AutoIt language as "possible" malware, and scare everyone who doesn't know better.

I've ranted on this behavior for a while, but it is absolutely irresponsible of these companies.  I can appreciate them being overly cautious, but they need to stop marking stuff that they don't understand as being "DETECTED".  If they want to show a window that says "This program was built with the AutoIt language, and cannot be further analyzed so it is impossible for us to know if it's safe." that would be fine.  But they need to stop pretending they have detected malware signs when they haven't.

These false positives happen all the time with the AutoIt and AutoHotkey languages, and it has a very serious and unfair detrimental affect on the usability of these languages.  I blame the antivirus companies almost entirely, but the AutoIt and AutoHotkey communities also must share in some of the blame for not rising up and mounting a real effort to get the anti-malware companies to stop this outrageous behavior.
« Last Edit: August 25, 2013, 10:24 AM by mouser »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Oh oh ... pls... don't get mad, Mouser...

As said, I am very happy with this tool from 4wd.
It is a unique thing: if you would be looking for something like this (GUI based), you won't find it.
There are no attribute changers that can do this (only a very few, using scripting, command prompt things)

Also, I am not a person to offend / annoy anybody.
It is not my nature. Especially not when 4wd has done such a nice job!   :Thmbsup:

Maybe I have chosen the wrong wordings, I don't know.
But pls 4wd / Mouser donot get mad, okay?   :)

=





dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Works very nice!!

It also handles multiple folders.

Minor thing: if one selects multiple folders but decide not to do anything, the small adjust time panels remain open.
One has to click cancel one by one.

It is no problem for me!!
Don't get me wrong.

Maybe in case of multiple folders, there cud be something like ; For All ?

Again, if not possible/too complex  leave it as it is!

It is great!  :Thmbsup:  :Thmbsup:

Many many thanks!
=

SnagIt-25082013 180956.png
=

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
When the installer is used, can I then tell where it should be installed?

No need to tell it where the executable is, just put it in F:\SetFolDate then run it and click install.

Based on the earlier version (I was not yet aware of this new release, as I am reading it just now) it would be:

F:\SetFolDate

and with below registry-patch

//
Code: Text [Select]
  1. REGEDIT4
  2.      
  3. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest]
  4. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Newest\command]
  5. @="\"F:\\SetFolDate\\SetFolDate.exe\" \"%1\" /n"
  6. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest]
  7. [HKEY_CLASSES_ROOT\Directory\shell\Adjust Timestamp Oldest\command]
  8. @="\"F:\\F:\SetFolDate\\SetFolDate.exe\" \"%1\" /o"

//

That would be correct but that reg file is no longer compatible with v0.2.0.0 since the latest version only takes one argument.  (It'll work with the later version but the Newest/Oldest argument will be ignored and it'll open the date option window instead.)

So briefly:

v0.1.0.0 requires the reg file
v0.2.0.0 just run it to install

GData and Bitdefender reported: Gen:Trojan.Heur.AutoIT.1

As mouser said, it's just those programs being lazy.  Rather than judge a program by its actions they've judged it by the language it was written in.

Anyway, source code is included, one of the guys/gals here will yell at me if it does something it shouldn't.  It's only 125 lines and most of that is the two windows, (install and date options).

Minor thing: if one selects multiple folders but decide not to do anything, the small adjust time panels remain open.
One has to click cancel one by one.

It is no problem for me!!
Don't get me wrong.

Maybe in case of multiple folders, there cud be something like ; For All ?

Unfortunately, that's the way Windows works with the context menu - it passes multiple selections one at a time.

eg. If you select folder AAA, BBB, and CCC then use the context menu, the following commands are executed:

SetFolDate.exe "AAA"
SetFolDate.exe "BBB"
SetFolDate.exe "CCC"

Three separate commands sent all at once, so you end up with three separate instances of the program running.

The only way to end them all would be to have a button that killed any occurance of the process.

Unless I can find a way to get all selected folders all at once so you get this:

SetFolDate.exe "AAA" "BBB" "CCC"

You're kind of stuck with how it works at the moment.

The only other option is take make it use command line arguments so it doesn't open a window at all.  But then you need context menus to cover either every combination or the most common ones.

EDIT: I just noticed you use DOpus ... I've got an idea ;D
« Last Edit: August 25, 2013, 11:34 AM by 4wd »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
But pls 4wd / Mouser donot get mad, okay?   :)

No worries! - he's only mad with the anti-virus companies cause they dont give a, cause they dont, eh, care enough - leading to thousands of false-positives.
Tom

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
@4wd - thanks again. All clear. I did some testing.
The tool is very nice! It helps me a lot, really.

I cannot think of any real improvements.

1) I think it is defaulted to 'Newest' - so when 'Oldest' is selected for one specific folder, the redating of the next folder will be again based on 'Newest', which is perfect (and normal)

2) As far as I can see, it can handle single folders, in Explorer's right window panel.
This means:
- it will not work on 'nested' folders
- and also when selecting a folder in the left window panel (tree).
Maybe this could be an additional 'Note' to the tool (leave that to you)

3) for testing purposes I created a folder1, with 4 subfolders, i.e. upto subfolder5
One way or the other on subfolder5 it does not work.
I know, so many subfolders, it will hardly happen, I created it for testing purposes only.

Tried with another folder under subfolder5  (i.e. subfolder6) but that does not do it either.
I cud redate to 'oldest' date for folders1,2,3,4 and back to newest, no problem.

best regards

=
SnagIt-26082013 091200.png
=








4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
I think you've come up against the "path too long" problem, should be able to get around it hopefully - I'll see what I can come up with.

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Yep!

You are so right!
280 characters or something.
Didn't think of it...  :-[

Wish I hadn't posted that last thing.
Made me look so silly.
I didn't write you anything, right?  :)

=




4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
OK, this is interesting, it looks like Windows takes care of long paths by itself, (Win 7 x64), eg.

Here's a path I made that has in excess of 280 characters:

2013-08-27 14_10_45-U__test.png

Here's the argument passed to SetFolDate:

2013-08-27 14_07_24-.png

Windows has used 8.3 naming (xxxxxx~1) to pass the argument, the number at the end (|143) says it's only 143 characters long.

This leads me to suspect the problem lies in the command I use to set the date.  I'll be able to get around that easily enough by changing directory before issuing the command.

Back to the drawing board  :)
« Last Edit: September 04, 2013, 02:19 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Many thanks for all the good work you are doing!

Skrell

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 14
    • View Profile
    • Donate to Member
This looks REALLY cool!  Can it do subfolders too?   

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
This looks REALLY cool!  Can it do subfolders too?

No, it doesn't recurse.

ATM, I'm just working on getting it to work with multiple selected folders, (which will be if it's called from DOpus only - or possibly other filemanagers, depends if they can pass the same args).

I am thinking of a recurse option, maybe I'll start from scratch.

EDIT: I just realised that I can get the selected items from Windows Explorer - I did it in another script - back to the drawing board.
« Last Edit: August 29, 2013, 01:14 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
@skrell, coincidentally... I was think about the subfolders too!  :)

In fact, actually I had drafted a post, but whilst doing so I realised that it would be much too complicated and the script would have to be re-written from scratch.
Something I did not dare to ask.

Below was/is the DRAFT I wrote, but, again, I did not complete/send it, because as said too complex (I guess)


Code: Text [Select]
  1. //
  2. Hi 4WD,
  3.  
  4. Just curious to know...
  5.  
  6. Maybe a strange question, maybe impossible, I really have no idea...
  7.  
  8. Probably impossible/too complicated/whatever, in that case forget it.
  9.  
  10. Imagine following situation
  11.  
  12. x:\rootfolder  (no files)
  13. x:\rootfolder\subfolder1\                        -> (contains files)
  14. x:\rootfolder\subfolder1\subfolder2\             -> (contains files)
  15. x:\rootfolder\subfolder1\subfolder2\subfolder3\  -> (contains files)
  16.  
  17. In the tree (left) you select rootfolder, so in the right window panel subfolder1 shows up.
  18. Now in the right window panel you select subfolder1 and adjust timestamp.
  19. The script should check if a subfolder exists, if so, if another subfolder exists, and so.
  20. //

Ah well, of course, I leave this in hands of  4WD... it is for him to decide.

=




4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
In the works, now got Explorer multi-select working, (which was easier than I thought), so it only runs a single instance now, (no multiple open windows).

Still to do:
1) Get it to work out whether it's run from Explorer or something else, (mostly worked out)
2) Recurse
3) Execute All


This thread probably should be in Coding Snacks, one of the mods like to move it there?