LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically change the modified date of a folder

Solved!
Go to solution

Is there a way to programmatically change the last modified date of a folder?  The OpenG file info VI doesn't seem to work for a folder.

Jim

LV 2020
0 Kudos
Message 1 of 27
(3,284 Views)
Solution
Accepted by topic author lmtis

I think you should be able to use .NET, as the attached VI shows (although in my case, every folder fails this and says that the file is in use by another process. If the same happens to you I would suggest searching further).


___________________
Try to take over the world!
Message 2 of 27
(3,254 Views)

That worked perfectly tst.  Thank you very much.

Jim

LV 2020
0 Kudos
Message 3 of 27
(3,229 Views)

I'm trying to do the same thing, also after finding that the OpenG routine does not work for Folders.  As tst noted, I also get Error 1172, with a TargetInvocationException thrown because "the folder is being used by another process".  What did you do to get this to work without the error?

 

Bob Schor

0 Kudos
Message 4 of 27
(3,070 Views)

@Hooovahh wrote:

Crosspost


???  I assume (since you aren't adding anything "helpful") that this is a "criticism".  My reason for posting this here was to ask Imtis (or tst) how they got the .NET fix to work (as it seems to fail for both tst and me).  The other post was on the LAVA forum and was meant to address the OpenG "File Info" function, which a LAVA poster suggested would change the date of a folder.  Two different audiences, two different types of solutions, hence two posts.  Is this not OK?

 

BS

0 Kudos
Message 6 of 27
(3,036 Views)

Hi Bob,

 

All I did is run the vi that tst posted.  I was just playing around with it this morning (to refresh my memory) and it worked fine.  I am running XP Pro, and LV2011.  There seems to be a limit as to how far back you can set the date (can't do 1962, but 1999 works OK).

 

Jim

Jim

LV 2020
0 Kudos
Message 7 of 27
(3,006 Views)

Please don't take this as criticism.  Often users will post in multiple locations and get varying levels of help from each place they posted.  This makes for a fragmented discussion where one group of individuals aren't collaborating with a separate group of individuals who are working on the same problem.  Posting in both places is fine, but I think what helps is having a link from one post to the other, so that individuals in one group can see the discussion taking place in the other.  This helps avoiding suggesting the same solution twice, and help come up with solutions neither group has come up with yet.

 

At first glance the two posts looked similar enough that I thought this would be the case where the two groups can at least see the discussion taking place elsewhere.  If the two posts aren't related at all then I apologize for providing the link between them.

0 Kudos
Message 8 of 27
(3,004 Views)

Aha!  I suspect that this is something that "breaks" with Windows 7.  I've got an XP machine (a VM, actually), so I should be able to test and verify this.  I'll keep looking for a work-around ...

0 Kudos
Message 9 of 27
(2,986 Views)

Dear Hooovahh,

 

     Thanks for the clarification.  You are right, the Problem is the same, but there are two very different solutions, neither of which seem to work for me.  I just heard from Imtis that the .NET method that tst proposed works on Windows XP, though both tst and I could not get it to work (but I'm using Windows 7, and suspect this might be the culprit).

 

     My intention is to try a variety of approaches to solve the problem (updating Folder dates) and when/if I succeed (or someone "shows me how"), to post notes potentially to both audiences giving updates.

 

     I'm happy to do only a single post, and have it show up on both boards, but have no idea how to do this, hence I post to both places.  When I'm ready to post, maybe you can help me to do it more gracefully ...

 

Bob Schor

0 Kudos
Message 10 of 27
(2,984 Views)