Group 12 discussion #13
Replies: 8 comments
-
|
24th January, Meeting notes:
|
Beta Was this translation helpful? Give feedback.
-
|
Course that I've found really useful: https://www.youtube.com/watch?v=8DvywoWv6fI |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, just wanted to say hi! I'm about this month if you need any python help, will try to assist. Just give me an @ and wishing you luck! Joanna |
Beta Was this translation helpful? Give feedback.
-
|
Wed 28 Feb (meeting notes) Anna:
Dorothy:
Dina:
Libraries:
There is a space on the Study Group GitHub pages to drop in scripts that we are working on, so please do that. Anna's use case:
Ceilan:
Dina:
Amy:
Other resources: Next meeting: 27th March. Can use this discussion board to chat between meetings. |
Beta Was this translation helpful? Give feedback.
-
|
Here is the script I wrote for deleting hidden and other unwanted files from the external media: # Import the OS module that allows interacting with files and directories on the system
import os
# Enter directory path:
path = input("Enter directory path: ")
# Return object orientation in string format using function repr(), which generates the object orientation
# in string format, but also gives single quotes around the text
dir_path = repr(path)[1:-1]
# Open a text file that will be automatically closed when writing is finished
with open('list_of_unwanted_files.txt', 'w') as df:
# Use os.walk to list files in folders and subfolders
for root, dirs, files in os.walk(dir_path):
# When using os.walk() iteratively change the working directory as working the way through the sub-folders.
# To do this change the working directory to the root variable
os.chdir(root)
# Look for files that match the condition
for file in files:
if file.startswith('.') or file.startswith('~$') or file == 'Thumbs.db' or file == 'desktop.ini':
# Get file sizes
file_size = os.path.getsize(file)
# Create a list of files including paths and file sizes
line = (root + '\\' + file + ', ' + str(round(file_size / (1024), 2)) + ' MB')
# Replace two slashes with one slash for Windows paths
single_backslash_line = line.replace('\\\\', '\\')
# Write the list of files into the text file
df.write(single_backslash_line + '\n')
# os.remove(file) # - use for deleting the listed files |
Beta Was this translation helpful? Give feedback.
-
|
I tried to add the script to https://github.com/Digital-Preservation-Coalition/PythonStudyGroups/tree/main/Cohort1/Group12, but got a message " Uploads are disabled. File uploads require push access to this repository. " |
Beta Was this translation helpful? Give feedback.
-
|
Wed 27 March (meeting notes) Dorothy:
Dina:
Anna:
Discussion:
|
Beta Was this translation helpful? Give feedback.
-
|
Hello Group 12! I am not sure if I will make it to our meeting tomorrow (May 29th) as I will be traveling. If I'm not able to be there I wanted to share a brief update. I've been continuing to work through PY4E, and I also experimented with a script for extracting several zip files. Below is that script. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions