Sort/Filter by File Size
Hello- I am a PhD student in biological sciences looking to write my literature review for my dissertation. Due to the limited amount of storage I can afford, I'd like to remove some of the larger PDF files from my Zotero library. Is there a way to sort or filter files so I can easily view which are the largest?
Thanks!
Thanks!
If you want to keep some access to the bigger files from within Zotero, you could copy those files to another folder on your computer (eg cloud-mirrored folder) before moving them to the bin within Zotero (which will remove them from Zotero online storage when synced). Then use Add Attachment->Attach Link to File, so that Zotero can still find that file on that computer (in its new folder location). If you want to access them on another computer, you would have to copy them to the same path on that computer too (or use the Linked Attachment Base Directory setting if the path is different). For larger scale implementation of that linked file strategy, look at Zotfile.
I feel for students (or others) who can't afford sufficient paid online storage for their study needs. I might note that in the days before programs with online syncing, access to the same PDF/file collection across computers was commonly achieved by keeping them on a small portable HDD (that was moved between computers), and pointing the software to that drive, to find them in the same way on each computer. Some people still use that approach for Zotero PDF file storage.
> find . -name '*.pdf' -exec du -k {} + | sort -nr | awk '{ $1=""; print substr($0,2) }'
Print list with file size:
> find . -name '*.pdf' -exec du -k {} + | sort -nr | awk '{ size=$1 "K"; $1=""; print size " " substr($0,2) }'
You might need to use du -b option if you are using Linux.
ls -r *.pdf | Sort-Object -Property Length | Select -l 5
Lists all the pdfs, sorts them by file size, and prints out the five largest pdfs with their paths. If you have other attachments (e.g., html archives or word documents), they won't be detected by this command, which exclusively accounts for PDFs.
Admittedly, the "truer" PowerShell command would use
Get-ChildItem
, which is aliased byls
. (I don't really care, but here's to trying to preempt any terminally online fans of powershell).Get-ChildItem -r *.pdf | Sort-Object -Property Length | Select -l 5