Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I've created a TAR with some xml and classes, In another server i need to put those files in various directories, something like an installable, is possible?
Using CentOS
Thanks
You can easily just have a package.format and a python script that extracts from that format and moves the files to relative locations or an absolute location if you know that. Is that what you're looking for?
You can use zipfile for the extracting/compressing and shutil and os to move/delete/modify the files.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
I want to print the file path for the files and not directories located in nested folders using pandas. The path where the folder is located changes. The code should read the dynamic file path and print the path where the csv files are stored.
You can use the os library with the method walk.
You have few examples here:
read all files in sub folder with pandas
Do I understand os.walk right?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to find the absolute path of all of .mp3 formatted files from every directories of my system.
If you're using python, os.walk can help you.
Simple code like this can work:
import os
for data in os.walk('d:\\music'): # where to start searching
dir_path, folders, files = data
for f in files:
if f.lower().endswith('.mp3'):
print(os.path.join(dir_path, f))
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I've got files uploaded in a server, whose filenames are their id they have in my mongo database.
I've got a process that converts files from pdf to txt.
So, I want to delete the specified file without indicating it's extension.
Up to now, my code is as follows:
os.remove(os.path.join(app.config['UPLOAD_FOLDER'], str(document["_id"]) + ".txt"))
You can use glob to search folders with wildcards.
doc = str(document[“_id”])
glob.glob(‘{}.*’.format(doc))
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Im trying to write a python (2.7) program that can load a set of html files, search the files for certain variables and then extract the variables in json. Does anyone have an idea where to start, what commands or modules to import?
you might need beautifulsoup, this will help to parse the html.
You can open the html file using builtin python open funciton
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'd like to be able to list all files found in a directory tree on a server that requires authorization for access. If I were trying to list files within a local directory tree, I would use the os.walk functionality (quite simple, I like that); however, when I'm trying to search a secure server, I'm lost. I know the credentials to log onto that server, but I'm not sure of the steps needed to log in and retrieve the information above (I'm new to python). Can anyone provide examples? Thanks.