Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F75812836
Get_Existing_Files.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Aug 4, 10:52
Size
2 KB
Mime Type
text/x-c
Expires
Tue, Aug 6, 10:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19614399
Attached To
R3600 invenio-infoscience
Get_Existing_Files.py
View Options
## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
## start Python:
<
protect
>
## $Id$</protect>
<
protect
>
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
"""CDSware Submission Web Interface."""
<
protect
>
try
:
import
shutil
except
ImportError
,
e
:
print
"Error:
%s
"
%
e
import
sys
sys
.
exit
(
1
)
def
Get_Existing_Files
(
parameters
,
curdir
,
form
):
t
=
""
if
os
.
path
.
exists
(
"
%s
/files/MainFiles"
%
curdir
):
return
""
if
os
.
path
.
exists
(
"
%s
/archivepath"
%
curdir
):
fp
=
open
(
"
%s
/archivepath"
%
curdir
)
archivepath
=
fp
.
read
()
fp
.
close
()
else
:
return
""
if
os
.
path
.
exists
(
"
%s
/formatfile"
%
curdir
):
fp
=
open
(
"
%s
/formatfile"
%
curdir
)
formatfile
=
fp
.
read
()
fp
.
close
()
else
:
return
""
if
not
os
.
path
.
exists
(
"
%s
/files/AdditionalFiles"
%
curdir
):
os
.
makedirs
(
"
%s
/files/AdditionalFiles"
%
curdir
)
if
not
os
.
path
.
exists
(
"
%s
/files/MainFiles"
%
curdir
):
os
.
makedirs
(
"
%s
/files/MainFiles"
%
curdir
)
if
os
.
path
.
exists
(
archivepath
):
for
root
,
dirs
,
files
in
os
.
walk
(
archivepath
):
if
root
==
archivepath
:
for
file
in
files
:
if
re
.
search
(
"^
%s
\..*"
%
formatfile
,
file
):
shutil
.
copy
(
"
%s
/
%s
"
%
(
archivepath
,
file
),
"
%s
/files/MainFiles/
%s
"
%
(
curdir
,
file
))
shutil
.
copystat
(
"
%s
/
%s
"
%
(
archivepath
,
file
),
"
%s
/files/MainFiles/
%s
"
%
(
curdir
,
file
))
elif
root
==
"
%s
/
%s
"
%
(
archivepath
,
formatfile
):
for
file
in
files
:
shutil
.
copy
(
"
%s
/
%s
/
%s
"
%
(
archivepath
,
formatfile
,
file
),
"
%s
/files/AdditionalFiles/
%s
"
%
(
curdir
,
file
))
shutil
.
copystat
(
"
%s
/
%s
/
%s
"
%
(
archivepath
,
formatfile
,
file
),
"
%s
/files/AdditionalFiles/
%s
"
%
(
curdir
,
file
))
return
t
</
protect
>
Event Timeline
Log In to Comment