Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
crawlersNoticias
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
m3
crawlersNoticias
Commits
2d2177ac
Commit
2d2177ac
authored
7 years ago
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cuenta/elimina archivos vacios
parent
68beaf73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
check_empty_file.py
crawler_script/check_empty_file.py
+10
-4
No files found.
crawler_script/check_empty_file.py
View file @
2d2177ac
...
@@ -6,6 +6,7 @@ os.chdir(newsDir)
...
@@ -6,6 +6,7 @@ os.chdir(newsDir)
mediaLst
=
os
.
listdir
(
'.'
)
mediaLst
=
os
.
listdir
(
'.'
)
mediaLst
.
sort
()
mediaLst
.
sort
()
vacios_txt
=
open
(
'vacios.txt'
,
'w'
)
empty_count
=
0
empty_count
=
0
for
media
in
mediaLst
:
for
media
in
mediaLst
:
...
@@ -20,15 +21,20 @@ for media in mediaLst:
...
@@ -20,15 +21,20 @@ for media in mediaLst:
for
file
in
fileLst
:
for
file
in
fileLst
:
fileSize
=
os
.
stat
(
file
)
.
st_size
fileSize
=
os
.
stat
(
file
)
.
st_size
# print(media+'/'+year+'/'+file+' '+str(fileSize))
if
not
file
.
startswith
(
'.'
)
and
fileSize
<=
3
:
if
not
file
.
startswith
(
'.'
)
and
fileSize
<=
3
:
empty_count
+=
1
empty_count
+=
1
print
(
media
+
'/'
+
year
+
'/'
+
file
+
' '
+
str
(
fileSize
))
if
empty_count
==
1
:
# os.system('rm '+file)
vacios_txt
.
write
(
media
+
'/'
+
year
+
'/'
+
file
+
', '
+
'File size: '
+
str
(
fileSize
))
else
:
vacios_txt
.
write
(
'
\n
'
+
media
+
'/'
+
year
+
'/'
+
file
+
', '
+
'File size: '
+
str
(
fileSize
))
print
(
media
+
'/'
+
year
+
'/'
+
file
+
', '
+
'File size: '
+
str
(
fileSize
))
os
.
system
(
'rm '
+
file
)
os
.
chdir
(
'..'
)
os
.
chdir
(
'..'
)
os
.
chdir
(
'..'
)
os
.
chdir
(
'..'
)
print
(
'Archivos vacios: '
+
str
(
empty_count
))
vacios_txt
.
write
(
'
\n
'
+
'Total archivos vacios: '
+
str
(
empty_count
)
+
'
\n
'
)
\ No newline at end of file
vacios_txt
.
close
()
print
(
'Total archivos vacios: '
+
str
(
empty_count
))
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment