File tree 1 file changed +59
-0
lines changed
Image_Processing/src/image_sort_python
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ import shutil
4
+
5
+ from PIL
6
+ import Image
7
+
8
+ import PIL
9
+
10
+ import os .path , time
11
+
12
+ from datetime
13
+ import datetime
14
+
15
+ lis = []
16
+
17
+ old = ""
18
+
19
+ new = ""
20
+
21
+ lis = os .listdir ('C:\New folder\\ ' )
22
+
23
+ lis .sort ()
24
+
25
+ for x in lis :
26
+
27
+ if x == __file__ :
28
+
29
+ continue
30
+
31
+ if x == 'Thumbs.db' :
32
+
33
+ continue
34
+
35
+ print "created: %s" % time .ctime (os .path .getctime (x ))
36
+
37
+ datestring = time .ctime (os .path .getmtime (x ))
38
+
39
+ dt = datetime .strptime (datestring , '%a %b %d %H:%M:%S %Y' )
40
+
41
+ # old = str(dt.month) + '-' + str(dt.day) + '-' + str(dt.year)
42
+
43
+ #
44
+ if old == new :
45
+
46
+ #shutil.move(x, destinationDir)
47
+
48
+ #
49
+ else :
50
+
51
+ #new = str(dt.month) + '-' + str(dt.day) + '-' + str(dt.year)
52
+
53
+ destinationDir = 'C:\New folder\\ ' + str (dt .month ) + '-' + str (dt .day ) + '-' + str (dt .year )
54
+
55
+ if not os .path .exists (destinationDir ):
56
+
57
+ os .makedirs (destinationDir )
58
+
59
+ shutil .move (x , destinationDir )
You can’t perform that action at this time.
0 commit comments