OpenFileRequester Question

Just starting out? Need help? Post your questions and find answers here.
User avatar
Columbo
Enthusiast
Enthusiast
Posts: 303
Joined: Wed Sep 10, 2014 7:17 am
Location: Ontario Canada
Contact:

OpenFileRequester Question

Post by Columbo »

When using OpenFileRequester() it displays the file names only. Is there a way to also show the file date? I may have backup files with different dates and I want to be able to load the proper file.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: OpenFileRequester Question

Post by IdeasVacuum »

That's a good question. The File Requester pops-up a form similar in type to Windows Explorer (on MS Windows) and the details displayed are as previously set by the User - so the developer doesn't know what info, apart from the filenames, the User sees. However the User can change what is seen within form, via options. Selecting "Details" or "Content" does at least show Date Modified.

Everyone is different. I always postfix the date to the filename on backup, and backups are on a separate physical drive.

If the program you are writing needs to handle the backup of files it processes, then you could use a prefix or postfix system to record their state.

Perhaps someone else knows how to reveal the file date and display in a DIY File Requester? Might need some API?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Columbo
Enthusiast
Enthusiast
Posts: 303
Joined: Wed Sep 10, 2014 7:17 am
Location: Ontario Canada
Contact:

Re: OpenFileRequester Question

Post by Columbo »

Postfixing the date to the filename on backup is what I was trying to do. When creating the backup file, if I use:

Code: Select all

destinationFile.s = destinationPath + "MyFile.bak"
it saves the file with no errors but if I use:

Code: Select all

destinationFile.s = destinationPath + "MyFile.bak" + FormatDate("%mm/%dd/%yyyy", Date())
I get a "Error creating file."
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
User avatar
Kiffi
Addict
Addict
Posts: 1362
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: OpenFileRequester Question

Post by Kiffi »

Not allowed characters in a file name: \ / : * ? " < > |

FormatDate("%mm-%dd-%yyyy", Date()) should work.
Hygge
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: OpenFileRequester Question

Post by Tenaja »

Try this, it might help...

GetFileDate()
User avatar
Columbo
Enthusiast
Enthusiast
Posts: 303
Joined: Wed Sep 10, 2014 7:17 am
Location: Ontario Canada
Contact:

Re: OpenFileRequester Question

Post by Columbo »

Thanks Kiffi. That works perfectly!

Thanks Tenaja but the problem with GetFileDate() is that it gives you an unformatted date. For example, April 6, 2020 is retrieved as 1584537458.

Thanks again to both.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
User avatar
Bisonte
Addict
Addict
Posts: 1233
Joined: Tue Oct 09, 2007 2:15 am

Re: OpenFileRequester Question

Post by Bisonte »

Columbo wrote:For example, April 6, 2020 is retrieved as 1584537458.

Code: Select all

String$ = FormatDate("%dd.%mm.%yy - %hh:%ii", 1584537458)
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Post Reply