Note that there are some explanatory texts on larger screens.

plurals
  1. POStrip file path info to • and / text item delimiter
    text
    copied!<p>The script below basically you choose a folder with PDFs, get file count of PDFs on chosen folders, write the results in text file, open the text file in Excel. The scripts works fine but I get entire the file path.</p> <p>Results are:</p> <pre><code>/Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/BODY/: 65 /Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/BODY/: RESENDS 0 /Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/COVERS/: 23 /Volumes/PREPRESS/1_CATALOG/2_Press/PRINT_Catalog/2012/•CUSTO_4/COVERS/: RESENDS 6 </code></pre> <p>I want to strip everything before the bullet • then for every / a column. Something like this:</p> <pre><code>CUSTO_4 BODY 65 CUSTO_4 BODY RESENDS 0 CUSTO_4 COVERS 23 CUSTO_4 COVERS RESENDS 6 </code></pre> <p>I trying to grasp the concept of text item delimiters and using the offset command but I don't know how to implement that into the script.</p> <p>set target_folder to choose folder with prompt "Choose target folders containing only PDFs to count files" with multiple selections allowed without invisible set results to ""</p> <pre><code> repeat with i from 1 to (count target_folder) set thisFolder to (POSIX path of item i of target_folder) --Find &amp; count all PDFs in folders selected that DON'T starts with letter R set fileCount to do shell script "find " &amp; quoted form of thisFolder &amp; " -type f -name *.pdf -and -not -iname 'R[0-9-_]*.pdf' | wc -l" set results to (results &amp; "" &amp; thisFolder &amp; ":" &amp; fileCount &amp; return) --Find &amp; count all PDFs in folders selected that starts with letter R set fileCount to do shell script "find " &amp; quoted form of thisFolder &amp; " -type f -iname 'R[0-9-_]*.pdf' | wc -l" set results to (results &amp; "" &amp; thisFolder &amp; ":" &amp; tab &amp; tab &amp; "RESENDS" &amp; fileCount &amp; return) end repeat --write results to a txt file set theFilePath to (path to desktop folder as string) &amp; "PDF File Count.txt" set theFile to open for access file theFilePath with write permission try set eof of theFile to 0 write results to file theFilePath close access theFile on error close access theFile end try --Will open the the PDF File Count.txt in Excel tell application "Microsoft Excel" activate open text file filename "PDF File Count.txt" end tell </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload