Im looking for the most efficient/fast approach here.
I have a directory with a huge number of files. I need to copy certain files to another directory.
I can find what files to copy based on the name and the date part of the datetime stamp. So I know i’m looking for a file that is called *animals*20012025*.csv but I don’t know the exact filename. I also know the date modified (that shows in windows).
The script I have now checks the directory for files that have the date modified that I want and then the file name pattern. But this takes quite long, it seems like Python tries to scan/loop through the whole directory.
What would be the best way to handle this?
submitted by /u/karaqz
[link] [comments]
r/learnpython Im looking for the most efficient/fast approach here. I have a directory with a huge number of files. I need to copy certain files to another directory. I can find what files to copy based on the name and the date part of the datetime stamp. So I know i’m looking for a file that is called *animals*20012025*.csv but I don’t know the exact filename. I also know the date modified (that shows in windows). The script I have now checks the directory for files that have the date modified that I want and then the file name pattern. But this takes quite long, it seems like Python tries to scan/loop through the whole directory. What would be the best way to handle this? submitted by /u/karaqz [link] [comments]
Im looking for the most efficient/fast approach here.
I have a directory with a huge number of files. I need to copy certain files to another directory.
I can find what files to copy based on the name and the date part of the datetime stamp. So I know i’m looking for a file that is called *animals*20012025*.csv but I don’t know the exact filename. I also know the date modified (that shows in windows).
The script I have now checks the directory for files that have the date modified that I want and then the file name pattern. But this takes quite long, it seems like Python tries to scan/loop through the whole directory.
What would be the best way to handle this?
submitted by /u/karaqz
[link] [comments]