Hello All,
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
Does someone could help me?
Here is my script:
import os, stat, time, datetime
a= "c:\\"
filesys = os.listdir(a)
today= datetime.date.today()
def get_create_time(a):
int_time = os.stat("c:\\")[stat.ST_CTIME]
str_time = time.ctime(int_time)
return str_time
#print filesys
for file in filesys:
create_time = get_create_time(a)
print file, create_time[-4:]
# print today
Thanks
Awel 6 9966
On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
Build a `datetime.date` object from the timestamp you get from the stat
call:
In [438]: !touch test.py
In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime)
Out[439]: datetime.date(2007, 11, 6)
Ciao,
Marc 'BlackJack' Rintsch
On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
In [28]: import time
In [29]: time.time()
Out[29]: 1194338141.5951259
On 6 nov, 09:00, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
Build a `datetime.date` object from the timestamp you get from the stat
call:
In [438]: !touch test.py
In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime)
Out[439]: datetime.date(2007, 11, 6)
Ciao,
Marc 'BlackJack' Rintsch
Could you explain a little more because I am new in scripting?
Thanks
Awel
On Tue, 06 Nov 2007 01:45:02 -0800, awel wrote:
On 6 nov, 09:00, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
>On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
Build a `datetime.date` object from the timestamp you get from the stat call:
In [438]: !touch test.py
In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime) Out[439]: datetime.date(2007, 11, 6)
Ciao, Marc 'BlackJack' Rintsch
Could you explain a little more because I am new in scripting?
Not really. I showed you the call I made and the result I got. How can I
be more clear and precise!?
Ciao,
Marc 'BlackJack' Rintsch
On 6 nov, 11:27, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
On Tue, 06 Nov 2007 01:45:02 -0800, awel wrote:
On 6 nov, 09:00, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
On Mon, 05 Nov 2007 23:33:16 -0800, awel wrote:
I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat [stat.ST_CTIME]' is different from
the one that I receive from the 'datetime.date.today()'.
Build a `datetime.date` object from the timestamp you get from the stat
call:
In [438]: !touch test.py
In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime)
Out[439]: datetime.date(2007, 11, 6)
Ciao,
Marc 'BlackJack' Rintsch
Could you explain a little more because I am new in scripting?
Not really. I showed you the call I made and the result I got. How can I
be more clear and precise!?
Ciao,
Marc 'BlackJack' Rintsch- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
Ok but I run in Windows and I cannot understand your '!touch test.py'
On Tue, 06 Nov 2007 02:35:46 -0800, awel wrote:
>In [438]: !touch test.py
>In [439]: datetime.date.fromtimestamp(os.stat('/home/bj/test.py').st_ctime) Out[439]: datetime.date(2007, 11, 6)
Could you explain a little more because I am new in scripting?
Not really. I showed you the call I made and the result I got. How can I be more clear and precise!?
Ok but I run in Windows and I cannot understand your '!touch test.py'
Ah, sorry this was just to create and/or make sure that the file exists
and has today's date.
Ciao,
Marc 'BlackJack' Rintsch This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt Traxinger |
last post by:
Is there a function that determines when a file was created? Like if I
wanted to return all the files created in the last month from a directory,
is there a way to do that? I've googled and googled...
|
by: [ EuGeNe ] |
last post by:
Hi all,
I would like to write a script that downloads one file from a ftp
server if the file creation date satisfy a condition.
I can't figure out how to find from a ftp server what is the...
|
by: Dave |
last post by:
I recently did a search of my very first web site, through WebArchive,
located here:
http://web.archive.org/collections/web.html
However, I'm seeking the creation date of my web site (and...
|
by: David Fickbohm |
last post by:
People,
I am trying to determine the creation date of files in a folder.
I am using the following code to find the folder and confirm that files
exist in the folder. If someone could give me an...
|
by: nek |
last post by:
Greetings,
I am running DB2 WSE V8.1, FP5 on W2K.
The problem is not directly related to DB2 but as part of job, I need
to manipulate files coming in from all sources.
Under a main folder,...
|
by: Steven Blair |
last post by:
Hi,
I have a trace log file for a system I am writing. If the creation date
is older than 14 days, I have to rename that file (File.Move). The next
time a trace message is required a new file is...
|
by: Steve Teeples |
last post by:
I am using the Filter property within OpenFileDialog. I understand how to
filter files with extensions, but this time I need to filter files without
extensions. Can someone tell me how this is...
|
by: fonzie |
last post by:
Is there any way to include two unbound text boxes (for a start date
and end date) to a filter-by-form? The users may want to filter by
several different fields and they may want to include a date...
|
by: tkpmep |
last post by:
I'd like to create a list of all files in a directory that were created
after a certain date. How does one do this? I've used glob.glob to
create a list of all files whose name matches a substring,...
|
by: MrDeej |
last post by:
Hello!
I am designing an import module in my access database for text files
it looks like thisDim GammeltNavn As String
Dim NyttNavn As String
Dim MaskinNavn As String
Dim fsoFileSearch As...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |