FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JSON-DOC/python/scripts/utils.py at main · textcortex/JSON-DOC · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
textcortex
/
JSON-DOC
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
6
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JSON-DOC
/
python
/
scripts
/
utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (26 loc) · 1.15 KB
Breadcrumbs
JSON-DOC
/
python
/
scripts
/
utils.py
Copy path
File metadata and controls
31 lines (26 loc) · 1.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import
os
def
copy_directory_without_comments
(
source_dir
:
str
,
destination_dir
:
str
):
# Create the destination directory if it doesn't exist
if
not
os
.
path
.
exists
(
destination_dir
):
os
.
makedirs
(
destination_dir
)
# Walk through the source directory
for
root
,
dirs
,
files
in
os
.
walk
(
source_dir
):
# Create corresponding subdirectories in the destination
for
dir_name
in
dirs
:
source_subdir
=
os
.
path
.
join
(
root
,
dir_name
)
dest_subdir
=
os
.
path
.
join
(
destination_dir
,
os
.
path
.
relpath
(
source_subdir
,
source_dir
)
)
if
not
os
.
path
.
exists
(
dest_subdir
):
os
.
makedirs
(
dest_subdir
)
# Process files
for
file_name
in
files
:
source_file
=
os
.
path
.
join
(
root
,
file_name
)
dest_file
=
os
.
path
.
join
(
destination_dir
,
os
.
path
.
relpath
(
source_file
,
source_dir
)
)
# Copy and process the file
with
open
(
source_file
,
"r"
)
as
src
,
open
(
dest_file
,
"w"
)
as
dst
:
for
line
in
src
:
if
not
line
.
lstrip
().
startswith
(
"//"
):
dst
.
write
(
line
)
Back
|
FazBrowse Home
|
New Git URL