Hi Rui
AFAIK qtr is supposed to delete all unused audio files on exit but it doesn't seem to catch everything. I started a session recently that has been all MIDI until last night when I recorded some audio tracks. My session only uses 2 audio clips currently but there are 3 audio files in my session folder so qtr failed to zap one.
Is there a manual way to force qtr to do a clean-up?
Thanks
re. Manual clean-up of unused audio files?
indeed there is:
on the Files pane, either Audio or MIDI, the right-click/context-menu has this Cleanup option... it removes files there listed that aren't used or referenced by any clips in session.
the usual disclaimer applies: use it with care ;)
hth.
cheers
so then
It did it occur to me at some point before I read your reply that I should've checked there. Maybe I thought that too obvious or something? Yes, the manual cleanup option seems to work fine, thanks.
Now I'm wondering what qtr does with unused audio files when you quit a session. It seems to delete some but not all unused files automatically so could you please explain how it decides what to delete and what to keep if you don't do a manual cleanup?
Cheers RNCBC!
re. so then
rules of thumb, to keep in mind:~
- files created within a qtractor session, including the recorded and revised ones as through iterated midi clip editing/overdubbing, are considered persistent (ie. not eligible for auto-removal) as soon you hit the (explicit) save session command (ie. menu File/Save et al.): from that moment onwards, all newly lingering files are thereafter considered committed and permanent to the file-system, even though they're not referred by any clips in the current qtractor session.
the cleanup procedure mentioned before (Files/Cleanup) will only get the file names de-listed though, actual files will persist on the file-system.
hth
cheers
Remove them for good
This is what I use to remove the unused files (after, of course, running the aforementioned precious "cleanup" routine)
for wav in *.wav
do grep -q -F "$wav" SessionFile.qtr || rm -fv "$wav"
done
TODO: Get rid of the corresponding .peak files
V0.1 : Hard-crop the wav files, leaving only Nsecs before and after the actually used time (for archiving)
Thanks
Thanks for your script xaccrocheur - I'll try that soon!
This should prob be included in the wiki until Rui makes it redundant :)
Handy script
I've tried your qtr session dir cleaning script now xaccrocheur and it seems to do the trick, or at least it gets rid of most of the unused wavs.
Due to the way qtr saves and cleans-up its project files and the way this script works it is unable to remove every unused wav file. I had some wav files I had copied into my session dir before I imported them into qtr. I ended up removing these files from the session, using qtr's file clean-up option, saving the cleaned session and then running this clean-up script. qtr does not remove the records of files that have been imported from the .qtr file after you've removed them from the session and done a clean-up under the qtractor file window and so this clean-up script didn't remove any of them.
I'll still be using it regardless of this shortcomijng so thanks again for sharing it!
Move cleaned files into sub-folder(s)
Thanks for explaining that Rui!
I'd not noticed that cleanup didn't actually delete the unused files, which is what I was actually wanting to do. I can understand why you'd be wary of having it do that though so I'd like to suggest that instead the clean-up option move all currently unused audio files into a sub-dir of the projects folder called something like Cleanup_audio_files and Cleanup_MIDI_files or just stick 'em all into Cleanup_files. That would make deleting the unused files much easier and no-one can cry about qtr accidentally deleting their stuff.
Would you accept this as Yet Another danboid Feature Request please?
Thanks Rui!
re. Move cleaned files into sub-folder(s)
as said, files are only actually deleted from the file-system if you don't save the session where those are recorded/created; exception goes to exported files: they become permanent once created.
one very special case is about sessions saved in archive/zip format (*.qtz) where only in-use files are included, all others are ditched when the extraction directory gets cleaned up on session close (user's option).
hth.
cheers
My final cleanup script
Hi, here is my latest version ; Master Capela, can you confirm that it will effectively delete any leftover file?
Note: It is designed to work with both zsh and (ba)sh
question
Is this part of a separate script? or is added before compiling?
re. question
it's just a custom shell script all right.
byee
Muse sequencer uses this
Muse sequencer uses this script
maybe it can be adapted
#!/usr/bin/python
# -*- coding: utf-8 -*-
#=============================================================================
# MusE
# Linux Music Editor
# $Id:$
#
# Copyright (C) 1999-2011 by Werner Schweer and others
#
# This program 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.
#
# This program 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 this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#=============================================================================
import os
import string
import shutil
dirlist = os.listdir(".")
wavs=[]
print "muse-find-unused-wavs - check wav file usage in all *.med files in current dir."
print ""
print "This utility scans all med files in the current dir, maps their"
print "wave file usage to what is currently available in current dir."
print "The output is printed."
print "Files no longer used are moved to the subdir 'unused'"
print "Press enter to continue."
print ""
raw_input()
for line in dirlist:
if (line.endswith( ".wav")):
#print "HA!", line
wavs.append(line)
print "===================================================="
print "===================================================="
print " These wave files were found in current directory:\n"
if wavs == []:
print "No files were found."
sys.exit(0)
else:
for f in wavs:
print f
for line in dirlist:
if (line.endswith( ".med") ):
#print "HO!", line
med = file(line)
for line in med:
for wav in wavs:
if line.find(wav) != -1:
#print "found %s removing %s"%(line, wav)
wavs.remove(wav)
print "===================================================="
print " These wave files were unused:\n"
if wavs == []:
print "None"
else:
for f in wavs:
print f
print "moving to new subdir unused, press Enter to continue"
raw_input()
try:
os.mkdir('unused')
except:
pass
for f in wavs:
shutil.move(f,'unused')
print "===================================================="
print "===================================================="
Add new comment