| Author |
Message |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 01 Nov 2007, 00:36 Post subject:
|
|
That's the one.
OK. I just updated the script. Changes:
-A bit extra in the help windows
-Quoted the ROX command - the script now fully works with spaces in the path/name of the output file
-Changed the defaults so they are set to the working directory. (I really was silly - I was using /temp instead of /tmp )
-Changed the file selector for the output file to accept folders instead of files, so you can choose an empty directory, but you have to manually add the file name, so you can't just click on an existing file.
I'll just go and remove that "apology dialog". It is a leftover from an earlier stage of the design process.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 01 Nov 2007, 03:30 Post subject:
|
|
OK, I sorted out the output file selection - that works great now.
If I can only get spaces in the input files to work...
|
|
Back to top
|
|
 |
john biles

Joined: 17 Sep 2006 Posts: 1323 Location: Australia
|
Posted: Thu 01 Nov 2007, 09:57 Post subject:
|
|
Hello disciple,
Just letting you know that I will be including joinPDF in the Bugfix / Update of TEENpup 2.14.1 which will be released soon.
_________________ Legacy OS 2 Released! Install me on a new! EXT2 Partition with 500Mb of swap and I'll be happy.
Legacy OS 4 Released! Install to newer legacy hardware / early EeePC's 
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 01 Nov 2007, 16:53 Post subject:
|
|
Sweet - hopefully some people will find it useful.
I've given up on trying to get it to work with spaces in the input files, as I can't figure out why gs can handle quoted inputs manually typed at the command line, but not from a script
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1231 Location: Ukraine
|
Posted: Thu 01 Nov 2007, 18:05 Post subject:
spaces in filenames |
|
Dear disciple,
I know this is a crude suggestion, but you could use a routine like the one below, but rather than using "mv" as in the attached script, replace it with "ln" to create symlinks in a temporary dir. You could then pass the symlinks to gs and remove them and the tmp dir after processing the pdfs. It's not a particularly elegant solution, I admit, but I think it just might do the trick.
I do find your program useful as I compose music and output scores to pdf files (for the moment, using Windows in a virtual machine). The parts - sometimes over 25 separate files for various instruments - also have to be included at the end of the main pdf (conductor's score) to simplify printing and emailing. JoinPdf does exactly what I need for that operation, so thanks.
With kind regards,
vovchik
| Code: | #!/bin/bash
IFS='
'
j=`find $1 -printf "%d\n" | sort -u | tail -n 1`
j=$((j-1))
echo "Max dir depth:" $j
for (( i=0; i<=j ; i++ ))
do
for name in `find -mindepth $i -maxdepth $i -iname "* *" -printf "%p\n"`
do
newname=`echo "$name" | tr " " "_"`
echo "$name" "$newname"
mv "$name" "$newname"
done
done
########## |
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 01 Nov 2007, 20:22 Post subject:
|
|
| Quote: | | I do find your program useful | That's nice to know.
I had thought of doing what you suggest, I was just waiting a while in case someone else had a look and figured out how to do it properly
It should be possible to do - I can do a script with the specific filenames in it, and that works, so I think I don't quite understand what's happening when I try to replace newlines from the sort output with spaces.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Sat 08 Dec 2007, 19:26 Post subject:
|
|
muggins thinks this approach might help deal with spaces in the name/path. It is too complicated for me, but someone else maybe able to do something with it
|
|
Back to top
|
|
 |
muggins
Joined: 20 Jan 2006 Posts: 6660 Location: lisbon
|
Posted: Sat 08 Dec 2007, 19:51 Post subject:
|
|
Sorry Disciple,
I should have clarified. The only bit that deals with filenames containing spaces could be summarised as:
| Code: |
......whatever pre-processing is done here......
for file in $directory/*
do
if [ -d "$file" ]; then #To identify if it's a directory
cd "$file" #If so change to that directory
scriptname #The script is calling itself recursively to process the directory
cd .. #Then when finished, go back up one directory
else
filename=${file%.pdf} #This bit deals with spaces in filename
xxx "$filename.pdf" #This is whatever processing your script does
fi
done |
I hope that's a bit clearer. All the rest of that other script was just to do with whether the user passed any arguments to the script, and to identify .pdf files from other files.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Sat 08 Dec 2007, 20:27 Post subject:
|
|
Yes, but I couldn't figure out how to integrate that with the recursive approach of my script
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Mon 25 Aug 2008, 06:34 Post subject:
Subject description: OK, I have the solution, now I just need the time to figure out the necessary code |
|
We can create a temporary folder somewhere, and as we find each pdf, symlink it into that folder, with a name that is the current count, and then we join like this:
~# gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="/ouput path/output file.pdf" ~/.joinpdf/*.pdf
I checked, and gs does join files with an *, so now we just need to figure out how to create all those symlinks. I figure no one will be joining more than 100 files, so we can start at 01. Or I guess to be really sure we could do 001, 002, 003...
Or maybe it would be easier to start at 100 so we don't have to figure out a way to prefix the zeros. So we just somehow get a count and add 100.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Sat 30 Aug 2008, 03:08 Post subject:
Updated joinPdf Subject description: gui to combine Pdf files |
|
OK, fixed. New version in the first post.
Thanks Pizzasgood for the help.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 06 Aug 2009, 04:17 Post subject:
|
|
You might also like to try pdfshuffler.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Thu 27 Aug 2009, 05:28 Post subject:
|
|
I've made an 11MB .sfs to make it easy to install pdfshuffler and its dependencies - python, pygtk etc. http://www.murga-linux.com/puppy/viewtopic.php?t=45826
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
|