Jump to content

FileGetTime problem


Go to solution Solved by WilliamasKumeliukas,

Recommended Posts

Run this:
 

#include <Array.au3>
#include <File.au3>

Local $amaster = _FileListToArray("E:\BKP\ESX1\")

_ArrayDisplay($amaster)

The element you want will look like $amaster[number]. This is the variable to use in the FileGetTime function. Note that function also returns an array, or a plain string of text if you specify.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

 
ok thanks it worked, now I need to get FileGetTime working.

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

I don't get how to get FileGetTime to work.

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

oh sorry I tought you were gone, I'm glad you still help me :D

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

Ok. I have rewritten your code a bit, I'll post it below, along with your code (commented out), so you can see the changes I've made to it. Ask some more if you have any problems, or if there's something you don't understand.

#cs
#Include <file.au3>
#include <date.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

;##################################
; Variables
;##################################
$amaster = "E:\BKP\ESX1\master.attisee.local"
$dmaster = FileGetTime($amaster & "\master.attisee.local-flat.vmdk",0)
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
$master = FileGetSize($amaster & "\master.attisee.local-flat.vmdk")

MsgBox(0,"test",$master & $tmaster)
#ce

$amaster = @Scriptdir & "\testdir\"
$dmaster = FileGetTime($amaster & "test.txt")
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
$master  = FileGetSize($amaster & "test.txt")

MsgBox(0,$amaster, $master & " " & $tmaster)

Note that $amaster can be defined as the directory and filename, but the two FileGet functions would have to be changed appropriately. Originally, that's how I had rewritten it, but changed it to more closely resemble your code.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Ok. I have rewritten your code a bit, I'll post it below, along with your code (commented out), so you can see the changes I've made to it. Ask some more if you have any problems, or if there's something you don't understand.

#cs
#Include <file.au3>
#include <date.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

;##################################
; Variables
;##################################
$amaster = "E:\BKP\ESX1\master.attisee.local"
$dmaster = FileGetTime($amaster & "\master.attisee.local-flat.vmdk",0)
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
$master = FileGetSize($amaster & "\master.attisee.local-flat.vmdk")

MsgBox(0,"test",$master & $tmaster)
#ce

$amaster = @Scriptdir & "\testdir\"
$dmaster = FileGetTime($amaster & "test.txt")
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
$master  = FileGetSize($amaster & "test.txt")

MsgBox(0,$amaster, $master & " " & $tmaster)

Note that $amaster can be defined as the directory and filename, but the two FileGet functions would have to be changed appropriately. Originally, that's how I had rewritten it, but changed it to more closely resemble your code.

I aldready can do this, I wanted to find a way that the script always get the directory subfolder inside "E:BKPESX1master.attisee.local" no matter what this subfolder name is. thats the reason why I am using FileListToArray Function.

everyday there a backup of the vm with robocopy that a folder with CURRENT date and time at end of the folder name, the backup files are inside this folder.

If I want this script to be functional everyday, it must get this folder name and return results into a variable (as i know so far).

FileListToArray was a test after searching on forums to find a way to get folder name.

I hope you understanding me, if not then advise me.

Regards,

AutomateLover

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

Ok, try this. In this particular case, I have two sub-directories in $amaster, 'testdir1' and 'testdir2', along with that file I was using earlier, but with the parameter '2', _FileList only returns the directories, which I believe you are aware of.

#include <Array.au3>
#include <File.au3>

$amaster = @Scriptdir & "\testdir\"
$fmaster = _FileListToArray($amaster, "*", 2)

_ArrayDisplay($fmaster)

So, $fmaster[0] is the number of directories found (2 in my case), $fmaster[1] is the name of the first directory and $fmaster[2] is the name of the second one.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Ok, try this. In this particular case, I have two sub-directories in $amaster, 'testdir1' and 'testdir2', along with that file I was using earlier, but with the parameter '2', _FileList only returns the directories, which I believe you are aware of.

#include <Array.au3>
#include <File.au3>

$amaster = @Scriptdir & "\testdir\"
$fmaster = _FileListToArray($amaster, "*", 2)

_ArrayDisplay($fmaster)

So, $fmaster[0] is the number of directories found (2 in my case), $fmaster[1] is the name of the first directory and $fmaster[2] is the name of the second one.

I only have 1 directory so this is for sure [1] to be used but how can I use $fmaster[1] in FileGetTime function?

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

$amaster = _FileListToArray("C:UserstestDesktoptestdir","*",2,True)

$dmaster = FileGetTime($amaster[1] & "test.txt") actually worked idk how and why,,,

Edited by AutomateLover

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

$amaster = _FileListToArray("C:UserstestDesktoptestdir","*",2,True)

$dmaster = FileGetTime($amaster[1] & "test.txt") actually worked idk how and why,,,

 

$amaster[1] & "test.txt" is equal to "pathfilename.ext" so FileGetTime would work on that.

 

inside testdir i have "uhdfuhfds" folder so it basically retrieve this folder name no matter what would be the name.

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

$amaster = _FileListToArray("C:UserstestDesktoptestdir","*",2,True)

That syntax is wrong. That UDF function accepts only 3 parameters. The last one you have, "True", is not required. Maybe you have an old version of AutoIt in which that parameter was used. What version do you have?

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

$amaster = _FileListToArray("C:UserstestDesktoptestdir","*",2,True)

That syntax is wrong. That UDF function accepts only 3 parameters. The last one you have, "True", is not required. Maybe you have an old version of AutoIt in which that parameter was used. What version do you have?

I used "True" to force it to use this parameter in case it would be by default "False"

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

ok, I tested without "True" and im back to "subscript used on non-accessible variable."

then added back "True" and now its working without errors.

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

lastest version ( not beta )

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
Share on other sites

  • Solution

SOLVED! FINALLY GOT IT WORKING! all those problems was only because my variables wasn't organized properly.

Thank you so much for your help somdcomputerguy and November :)

Couldn't been done without your helps!

I really appreciate it.

Best Regards,

AutomateLover

Edited by WilliamasKumeliukas

Sorry if it's quite challenging to understand me sometimes, there is 2 possible reasons to this:

Spoiler

#1. I am a native French speaker and learned English mainly from chatting with others players in online games.

#2. I have a developmental disorder mainly affecting my social abilities, way of thinking, understanding stuffs and explaining myself in which it can seem ironic of seeing me here, but I been working on getting better every days for an dozens of years now ^_^

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Do not like my dirty code? It's fine, but in my opinion, the dirty codes are unique and I believe it's a good glimpse of how the mind of the person who wrote it thinks, and that, that's what I call a psychological deduction step by step in all its splendor.

~WilliamasKumeliukas

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...