Batch-process all files in a directory
I'm relatively new to LabView. I'm using 5.1, and would like to open all the text files in a certain directory, and apply my formulaes to the data contained within each. How can I batch process a whole directory?
Hi,
first of all you need know names of files in your directory: for this purpose use File I/O / Advanced/List directory.vi. This vi get name of directory, pattern (*.txt for example) and returns array of path to files.
For all path use Read From Spreadsheet File.vi that get name of file and return 1 or 2-d array of data.
Now you can apply formula to data.
Similar Messages
-
Process all files in a directory and its subdirectories
Hello all,
I want to write a program that processes separately all the files in a given directory. I would like to open folders in that directory (if any) and further process all the files contained in them as well. Any suggestions with some Java code to do this as time effectively as possible? Thanks in advance.Hello Chuck,
thanks for answering. You probably meant: "Search the forum archive - maybe your question has already been discussed. This way you help people focus on topics that have not yet been resolved."
Generally http://forum.java.sun.com/thread.jspa?forumID=31&threadID=510545 suits well. My problem is however, that I would like to pass the absolute path (not the relative one) of the directory which content (including subdirectories if any) should be further processed. Any suggestions how to make it function with the absolute path passed as input argument to the program? -
In Photoshop Elements 12, is there a way to batch process all photos in a file with 'Auto Tone' and save the changes?
Thank you, that was perfect!
Yoni -
Sender File Adapter stop processing all files
Hello all,
the file adapter pick up all files in the directory by default.
if a large number of files are in the directory then this could slow down the pi processing.
is there any way to process only one file per polling??
regards>
Ralf Zimmerningkat wrote:
> Hello all,
> the file adapter pick up all files in the directory by default.
> if a large number of files are in the directory then this could slow down the pi processing.
> is there any way to process only one file per polling??
>
> regards
I do not have any proble if you have got the answer. BUT this blog says how to exclude the other files from the same folder.
Your Case: For example, Your Sender CC wants to pick up file ABC.txt from /xyz dir, now suppose there are 10 thousand files of same name in the dir and you want ABC.txt should be picked up one by one, So how this blog is going to help you. Can you Plz explain to me and others too?
@Sachin may be you can throw some light on this... may be I am missing something. -
Creating an action that treats all files in a directory
How can I make an action which changes the picture size and resolution for all files in a directory and saves the new versions of the files in a subdirectory?
ThanksMacro Details wrote:
First create your Sub directory. Then start the Action. Open file, Resisize save as (to Sub directory) then close the file.
Now: File- Automate-Batch. Select your action and your folders and overide the open Command and the Save As Command.
Frankly Norbert I think the Image processor way is easier but to each his own as they say. -
How can I create a array with all files from a directory
How can I create a array of files or varchar with all files from a directory?
I thought the example could be improved upon. I've posted a solution on my blog that doesn't require writing the directory list to a table. It simply returns it as a nested table of files as a SQL datatype. You can find it here:
http://maclochlainn.wordpress.com/2008/06/05/how-you-can-read-an-external-directory-list-from-sql/ -
Aim to process all files in folders on desktop to run through photoshop and save in multiple locations
Part one:-
Gather information from desktop to get brand names and week numbers from the folders
Excluding folders on desktop beginning with "2" or "Hot"
Not sure about the list of folders
but I have got this bit to work with
set folderPath to "Hal 9000:Users:matthew:Desktop:DIVA_WK30_PSD" --<<this would be gained from the items on the desktop
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
After running this I have enough information to create folders in multiple locations, (i need to know where they are so that photoshop can later save them in those multiple locations
So I need the following folders created
Locally
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName: brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathA
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName: brandName + "_WK" + weekNumber + "_HR"--(Set path for Later)PathB
Network
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:"Week" + weekNumber
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:"Week" + weekNumber:brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathC
Volumes:GEN:Website_Images --(no need to create folder just set path)PathD
FTP (Still as a normal Volume) So like another Network
Volumes:impulse:"Week" + weekNumber
Volumes:impulse:"Week" + weekNumber:Brand
Volumes:impulse:"Week" + weekNumber:Brand:brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathE
Volumes:impulse:"Week" + weekNumber:Brand:brandName + "_WK" + weekNumber + "_HR" --(Set path for Later)PathF
I like to think that is end of Part 1
Part 2
Take the images (PSD's) from those folders relevant to the Brand then possibly run more applescript that opens flattens and then saves it in the locations above.
For example….
An image in folder DIVA_WK30_PSD will then run an applescript in Photoshop, lets call it DivaProcessImages within this we then save to PathA, PathB, PathC, PathD, PathE, PathF the folder path of C should therefore look like this
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:Week30:DIVA_WK30_LR and of course save the image as original filename.
Then from the next folder
An image in folder Free_WK30_PSD will then run an applescript in Photoshop, lets call it FreeProcessImages within this we then save to PathA, PathB, PathC, PathD, PathE, PathF the folder path of C should therefore look like this
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:Week30:Free_WK30_LR and of course save the image as original filename.
The photoshop applescript i'm hoping will be easier as it should be a clearer step by step process without any if's and but's
Now for the coffee!!Hi,
MattJayC wrote:
Now to the other part, where each folder was created (and those that already existed) how do I set them as varibles?
For example,
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
This line was used to create more than one folder as it ran though the folders on the desktop. The next part is I will need to reference them to save files to them.
You can use a records
Examples
if you want the path of localBrandFolder_High_Res of "Diva", if "Diva" is the second folder of the Desktop
You get the path with this : localBrandFolder_High_Res of record 2 of myRecords
if you want the path of localWeekFolder in the first folder of the Desktop
You get the path with this : localWeekFolder of record 1 of myRecords
Here is the script
set myRecords to {}
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
repeat with i from 1 to number of items in dtF
set this_item to item i of dtF
if this_item does not start with "2_" and this_item does not start with "Hot" then
try
set folderPath to this_item
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
end try
try
set this_local_folder to "Hal 9000:Users:matthew:Pictures:2011-2012"
set var1 to my getFolderPath("WK" & weekNumber, this_local_folder)
set var2 to my getFolderPath(brandName, var1)
set var3 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var2)
set var4 to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", var2)
--set up names to destination folders and create over Netwrok including an already exisiting folder
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2012:"
set var5 to my getFolderPath("WK" & weekNumber, this_Network_folder)
set var6 to my getFolderPath(brandName, var5)
set var7 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var6)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set var8 to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set var9 to my getFolderPath(brandName, var8)
set var10 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var9)
set var11 to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", var9)
set end of myRecords to ¬
{localWeekFolder:var1, localBrandFolder:var2, localBrandFolder_Low_Res:var3, localBrandFolder_High_Res:var4, networkWeekFolder:var5, networkBrandFolder:var6, networkBrandFolder_Low_Res:var7, ftpWeekFolder:var8, ftpBrandFolder:var9, ftpBrandFolder_Low_Res:var10, ftpBrandFolder_High_Res:var11}
end try
end if
end repeat
localBrandFolder_High_Res of record 2 of myRecords -- get full path of localBrandFolder_High_Res in the second folder of Desktop
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath -
How to get the file size (in bytes) for all files in a directory?
How to get the file size (in bytes) for all files in a directory?
The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
Furthermore the size is not retrieved correctly.
How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
Thank you
Peter
java.io.File f = new java.io.File("D:/todo/");
files = f.list();
for (int i = 0; i < files.length; i++) {
System.out.println("fn=" + files);
if (new File(files[i]).isFile())
System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }pstein wrote:
...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
Here is an SSCCE.
import java.io.File;
class ListFiles {
public static void main(String[] args) {
java.io.File f = new java.io.File("/media/disk");
// provides only the file names, not the path/name!
//String[] files = f.list();
File[] files = f.listFiles();
for (int i = 0; i < files.length; i++) {
System.out.println("fn=" + files);
if (files[i].isFile()) {
System.out.println(
"file[" +
i +
"]=" +
files[i] +
" size=" +
(files[i]).length() );
}Edit 1:
Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form. It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM -
List all files in a directory on a server that hosts the applet
Hei :)
I have a problem. I want to list all files in a directory on my server. ( http://www.foo.bar/tw )
The applet is in the root folder ( http://www.foo.bar ).
So i tried it like this
File fi = new URL(getCodeBase() + "/all/").getFile();But when I try to list the files, I get a SecurityException.
Can anyone help me out?
Peace!
LoCalhttp://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=&qt=%2Blist+%2Bfile+%2Bserver
-
Finder not displaying all files in remote directory
Sorry, this is a repost as I have gotten no response from my original request here: Finder not displaying all files in remote directory
I've exported pictures from iPhoto on my iMac to a shared directory on my mac mini. When I access that directory from my iMac, I can see some but not all of the pictures. I know the pictures exported properly because I can see them all from the mac mini. I can open up a terminal window on my iMac and see all of the files; I can also open those files from the terminal.
I'm running OSX 10.9.4 on both computers, with the mac mini also running OSX Server. I've placed a screen grab below from my iMac of what Finder sees vs what I can see from the terminal.
Why isn't Finder displaying all of my files?thanks for responding
Adding a new file to the shared folder results in me being able to see the new file from my clients regardless of where it was added from, however the "hidden" files do not suddenly pop up.
I tried a few more experiments that had interesting results, but still didn't lead me to an answer.
First I tried copying the files from the remote directory to a local directory; I did this in 2 different ways and had different results. Method A) I copied files from the mounted share to a local dir: "cp /Volumes/MyShare/dir/*.JPG .". Method B) I copied the files using secure copy: "scp user@server:/path/to/dir/*.JPG .".
Method A resulted in Finder not being able to see the files in the local directory, while Method B did. This was interesting and lead me to suspect an issue with the way I am sharing the directory on the server. From Server settings I have both afp and smb checked. I tried enabling only one or the other and reconnecting; but this did not fix the problem.
Next I tried exporting the photos from iPhoto again. Exporting them locally results in files that Finder can see. Exporting them to my server results the same bad behavior
Getting desperate, I also tried renaming all of the files from "*.JPG" to "*.jpg" but this didn't help.
One last experiment, I see the same behavior from both another Mac and a PC on my local network... FTP works fine.
Any more ideas? -
Is there any way to play all files in a directory by one url?
Hi all,
I am testing fms this days, I have put all my files(such as 1.mp3,2.mp3...n.mp3) in my directory.
I can play single file fine with url like this:
rtmp://localhost/mp3/mp3:x/2
but i want to know is there any way to play all files in my direcotry?
for example, user click the play button, the player(smp) automatic plays all files in the directory, link windows media server.
Should I use playlist? Or there is another better way?
Thanks a lot.Hi,
FMS do not directly take a directory to play files, the file names have to be fetched some way (through script if needed) to make a playlist and then the play command needs to be repeated as many times.
Thank you ! -
How to remove all files in a directory in java?
I have tried method delete() of File ,
but no effect!
can anyone help me!
thank youSo, you have a directory and you want to delete all files in the directory. Here is some (untested) code:
File dir = new File("C:\\tempdir");
File[] files = dir.listFiles();
for (int i = 0; i < files.length; ++i) {
if (files.isFile()) {
files[i].delete();
Jesper -
hi all! im new to java and i was wondering if u can help me out!
ive wrote a small application which analysises words in a text file, and what i need to do is load all the files in a directory, rather than one at a time like in the following code. I understand that a loop is needed but i really dont know where to start! please help!
thanks for your time
oh also, is there a way of the system printing the filename rather than "this text is.."?
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
public class eval {
private String[] words;
private int[] values;
private int num;
private HashMap <String, Integer> hashMap;
private arrays a;
private String[] negwords;
private int[] negvalues;
private HashMap hashMap2;
private int negnum;
public eval() {
initiatemap();
BufferedReader in = null;
try {
in = new BufferedReader (new FileReader ("text.txt")); //id like this to load all files in a directory
String str;
String s;
while ((str = in.readLine()) != null)
str = str.replaceAll("[\\p{Punct}&&[^?????????????????????]]", " ");
String[]temp = str.split(" ");
for (int i = 0; i < temp.length; i++) {
if (hashMap.containsKey(temp)) {
num++;
for (int i = 0; i < temp.length; i++) {
if (hashMap2.containsKey(temp[i])) {
negnum++;
if (num > 0 && negnum > 0 ){
double total = num + negnum;
double txt1 = round((num/total)*100, 2);
if (txt1 < 50)
System.out.println("This text is " + txt1 + "% positive and is therefore not a happy text.");
else if (txt1 >= 50 && txt1 <=65)
System.out.println("This text is " + txt1 + "% positive, but does contain " + (100 - txt1) + "% negative words, it is therefore probably not a happy text.");
else if (txt1 > 65)
System.out.println("This text is " + txt1 + "% positive, and is therefore a happy text.");
in.close();
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static double round(double val, int places) {
long factor = (long)Math.pow(10,places);
// Shift the decimal the correct number of places
// to the right.
val = val * factor;
// Round to the nearest integer.
long tmp = Math.round(val);
// Shift the decimal the correct number of places
// back to the left.
return (double)tmp / factor;
public void initiatemap()
a = new arrays();
words = a.initiateWords();
negwords = a.initiateNegWords();
values = a.initiateValues();
negvalues = a.initiateNegValues();
hashMap = a.initiateMap();
hashMap2 = a.initiateNegMap();
for (int i = 0; i < words.length; i++) {
hashMap.put(words[i], values[i]);}
for (int j = 0; j < negwords.length; j++) {
hashMap2.put(negwords[j], negvalues[j]);}
public static void main(String[] args) {
eval eval = new eval();hi again,
ok thanks for the help, ive have made the changes and i am now getting results.. however the results aren't correct!
if i load the texts in one at a time, i get entirely different results to what is being printed. any suggestions?
thanks again, i really really appreciate your help
Torre
private static void readMultipleFilesFromADirectory()
File directory = new File(multipleFilesDirectory);
// just to double check that this is a directory
if (directory.isDirectory())
File[] allFilesWithinThisDirectory = directory.listFiles();
BufferedReader in = null;
for (File file: allFilesWithinThisDirectory)
initiatemap();
try {
in = new BufferedReader (new FileReader (file));
String str;
String s;
while ((str = in.readLine()) != null)
str = str.replaceAll("[
p{Punct}&&--^áâãäéêëìíîïòóôöùúûüçè]--", " ");
String[]temp = str.split(" ");
for (int i = 0; i < temp.length; i++) {
if (hashMap.containsKey(temp)) {
num++;
for (int i = 0; i < temp.length; i++) {
if (hashMap2.containsKey(temp[i])) {
negnum++;
if (num > 0 && negnum > 0 ){
double total = num + negnum;
double txt1 = round((num/total)*100, 2);
if (txt1 < 50)
System.out.println(file + " is " + txt1 + "% positive and is therefore not a happy text.");
else if (txt1 >= 50 && txt1 <=65)
System.out.println(file +" is " + txt1 + "% positive, but does contain " + (100 - txt1) + "% negative words, it is therefore probably not a happy text.");
else if (txt1 > 65)
System.out.println(file +" is " + txt1 + "% positive, and is therefore a happy text.");
in.close();
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
results:
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv416_11136.txt is 60.65% positive, but does contain 39.35% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv417_13115.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv418_14774.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv419_13394.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv420_28795.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv421_9709.txt is 60.65% positive, but does contain 39.35% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv422_9381.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv423_11155.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv424_8831.txt is 60.67% positive, but does contain 39.33% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv425_8250.txt is 60.67% positive, but does contain 39.33% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv426_10421.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv427_10825.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv428_11347.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv429_7439.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv430_17351.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv431_7085.txt is 60.67% positive, but does contain 39.33% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv432_14224.txt is 60.67% positive, but does contain 39.33% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv433_10144.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv434_5793.txt is 60.63% positive, but does contain 39.37% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv435_23110.txt is 60.62% positive, but does contain 39.38% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv436_19179.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv437_22849.txt is 60.69% positive, but does contain 39.31% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv438_8043.txt is 60.65% positive, but does contain 39.35% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv439_15970.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv440_15243.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv441_13711.txt is 60.64% positive, but does contain 39.36% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv442_13846.txt is 60.61% positive, but does contain 39.39% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv443_21118.txt is 60.61% positive, but does contain 39.39% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv444_9974.txt is 60.6% positive, but does contain 39.4% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv445_25882.txt is 60.56% positive, but does contain 39.44% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv446_11353.txt is 60.54% positive, but does contain 39.46% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv447_27332.txt is 60.54% positive, but does contain 39.46% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv448_14695.txt is 60.56% positive, but does contain 39.44% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv449_8785.txt is 60.55% positive, but does contain 39.45% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv450_7890.txt is 60.54% positive, but does contain 39.46% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv451_10690.txt is 60.54% positive, but does contain 39.46% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv452_5088.txt is 60.53% positive, but does contain 39.47% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv453_10379.txt is 60.56% positive, but does contain 39.44% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv454_2053.txt is 60.55% positive, but does contain 39.45% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv455_29000.txt is 60.55% positive, but does contain 39.45% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv456_18985.txt is 60.57% positive, but does contain 39.43% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv457_18453.txt is 60.53% positive, but does contain 39.47% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv458_8604.txt is 60.53% positive, but does contain 39.47% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv459_20319.txt is 60.5% positive, but does contain 39.5% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv460_10842.txt is 60.54% positive, but does contain 39.46% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv461_19600.txt is 60.48% positive, but does contain 39.52% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv462_19350.txt is 60.47% positive, but does contain 39.53% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv463_10343.txt is 60.49% positive, but does contain 39.51% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv464_15650.txt is 60.48% positive, but does contain 39.52% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv465_22431.txt is 60.46% positive, but does contain 39.54% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv466_18722.txt is 60.46% positive, but does contain 39.54% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv467_25773.txt is 60.45% positive, but does contain 39.55% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv468_15228.txt is 60.47% positive, but does contain 39.53% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv469_20630.txt is 60.42% positive, but does contain 39.58% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv470_15952.txt is 60.39% positive, but does contain 39.61% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv471_16858.txt is 60.4% positive, but does contain 39.6% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv472_29280.txt is 60.4% positive, but does contain 39.6% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv473_7367.txt is 60.38% positive, but does contain 39.62% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv474_10209.txt is 60.38% positive, but does contain 39.62% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv475_21692.txt is 60.42% positive, but does contain 39.58% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv476_16856.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv477_22479.txt is 60.48% positive, but does contain 39.52% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv478_14309.txt is 60.47% positive, but does contain 39.53% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv479_5649.txt is 60.44% positive, but does contain 39.56% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv480_19817.txt is 60.45% positive, but does contain 39.55% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv481_7436.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv482_10580.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv483_16378.txt is 60.44% positive, but does contain 39.56% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv484_25054.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv485_26649.txt is 60.45% positive, but does contain 39.55% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv486_9799.txt is 60.44% positive, but does contain 39.56% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv487_10446.txt is 60.42% positive, but does contain 39.58% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv488_19856.txt is 60.41% positive, but does contain 39.59% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv489_17906.txt is 60.4% positive, but does contain 39.6% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv490_17872.txt is 60.42% positive, but does contain 39.58% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv491_12145.txt is 60.44% positive, but does contain 39.56% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv492_18271.txt is 60.44% positive, but does contain 39.56% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv493_12839.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv494_17389.txt is 60.43% positive, but does contain 39.57% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv495_14518.txt is 60.41% positive, but does contain 39.59% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv496_10530.txt is 60.39% positive, but does contain 39.61% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv497_26980.txt is 60.39% positive, but does contain 39.61% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv498_8832.txt is 60.38% positive, but does contain 39.62% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv499_10658.txt is 60.38% positive, but does contain 39.62% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv500_10251.txt is 60.37% positive, but does contain 39.63% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv501_11657.txt is 60.34% positive, but does contain 39.66% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv502_10406.txt is 60.33% positive, but does contain 39.67% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv503_10558.txt is 60.35% positive, but does contain 39.65% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv504_29243.txt is 60.35% positive, but does contain 39.65% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv505_12090.txt is 60.3% positive, but does contain 39.7% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv506_15956.txt is 60.32% positive, but does contain 39.68% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv507_9220.txt is 60.3% positive, but does contain 39.7% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv508_16006.txt is 60.31% positive, but does contain 39.69% negative words, it is therefore probably not a happy text.
C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv509_15888.txt is 60.39% positive, but does contain 39.61% negative words, it is therefore probably not a happy text.
-
Deleting all files in a directory
Hi,
Is it possible to use cffile to delete all files in a
directory. I have a function that creates a file in seperate parts
and places the finished file into a folder. But I need a check to
delete all files currently existing in said folder. I understand it
is possible to query a folder for existing files and then use that
query with cffile to delete the files... I just don't know how to
do it.
Thanks for your helpI am not postivie, but I think I recall learning that the
delete all function is prohibited via CF. You can delete specific
files, though.
If this is, in fact, the case, you could query the directory,
and then loop through the resultant query, deleting each file one
at a time. -
[Bash] Massively replace text in all files of a directory
Hi everybody,
I wrote this small recursive function in order to massively replace some strings contained in all files of a directory (and all subdirectories). Any suggestions?
replaceText() {
# set the temporary location
local tFile="/tmp/out.tmp.$$"
# call variables
local script="$2"
local opts="${@:3}"
browse() {
for iFile in "$1"/*; do
if [ -d "$iFile" ];then
# enter subdirectory...
browse "$iFile"
elif [ -f $iFile -a -r $iFile ]; then
echo "$iFile"
sed $opts "s/$(echo $script)/g" "$iFile" > $tFile && mv $tFile "$iFile"
else
echo "Skip $iFile"
fi
done
browse $1
Syntax:
replaceText [path] [script] [sed options (optional)]
For example (it will replace "hello" with "hi" in all files):
replaceText /home/user/mydir hello/hi
Note: It is case-sensitive.
Bye,
grufo
Last edited by grufo (2012-11-10 15:05:43)falconindy wrote:
Yes, find is recursive and extremely good at its job.
http://mywiki.wooledge.org/UsingFind
Well
falconindy wrote:Your lack of quoting is dangerous, as is your code injection in sed. I'm not sure why you're echoing a var inside a command substitution inside a sed expression, but it's going to be subject to word splitting, all forms of expansion, and may very well break the sed expression entirely, leading to bad things. A contrived example, but passing something like 'foo//;d;s/bar/' should effectively delete the contents of every file the function touches.
So, if you consider it dangerous, you can adopt the whole "sed syntax" and confirm before continue...:
replaceText() {
# set the temporary location
local tFile="/tmp/out.tmp.$$"
# call variables
local sedArgs="${@:2}"
browse() {
for iFile in "$1"/*; do
if [ -d "$iFile" ];then
# enter subdirectory...
browse "$iFile"
elif [ -f $iFile -a -r $iFile ]; then
echo "$iFile"
sed $sedArgs "$iFile" > $tFile && mv $tFile "$iFile"
else
echo "Skip $iFile"
fi
done
while true; do
read -p "Do you want to apply \"sed $sedArgs\" to all files contained in the directory $1? [y/n] " yn
case $yn in
[Yy]* ) browse $1; break;;
* ) exit;;
esac
done
Syntax:
replaceText [parent directory] [sed arguments]
Example:
replaceText /your/path -r 's/OldText/NewText/g'
or, if you want to work directly with the current directory...
replaceText() {
# set the temporary location
local tFile="/tmp/out.tmp.$$"
# call variables
local sedArgs="$@"
browse() {
for iFile in "$1"/*; do
if [ -d "$iFile" ];then
# enter subdirectory...
browse "$iFile"
elif [ -f $iFile -a -r $iFile ]; then
echo "$iFile"
sed $sedArgs "$iFile" > $tFile && mv $tFile "$iFile"
else
echo "Skip $iFile"
fi
done
while true; do
read -p "Do you want to apply \"sed $sedArgs\" to all files contained in the directory $PWD? [y/n] " yn
case $yn in
[Yy]* ) browse $PWD; break;;
* ) exit;;
esac
done
Syntax:
replaceText [sed arguments]
Example:
replaceText -r 's/OldText/NewText/g'
What about?
falconindy wrote:I'll also point out that declaring a function within a function doesn't provide any amount of scoping -- 'browse' will be declared in the user's namespace after running this function for the first time.
See:
function1() {
function2() {
echo "Ciao"
function2
function2 # error
function1 # works
Maybe you are looking for
-
Is 'Repository Creation Utility' a mandatory for SOA Suite
Hi All, I am new to Oracle Weblogic 11g application server. I worked on Oracle 10g app server. I am very much interested in BPEL and planning to learn BPEL and SOA related concepts. I have Jdeveloper 11.1.1.0.1, Oracle Weblogic server 10.3.2, Oracle
-
Paste screenshot in outlook web access - OWA
Exchange server 2007 IE 8 Hello, Is it possible to paste/embed a screenshot into a new email through OWA ? Maybe in exchange server 2010 ? regards, wim.
-
Is it possible to post a GB song file- original work in progress in the idisk public folder - for another player to download and add a track - then down load the piece back to my computer. Does this work? Problems ? Thanks anyone. Powerbook G4 Mac
-
Error in account determination: table T030K key SPML J1R
Hi, i need help in below error Error in account determination: table T030K key SPML J1R Message no. FF709 Diagnosis In the chart of accounts to be posted to, no accounts are defined for the tax code you used. Procedure Contact your sy
-
Hi, For years I used Apple Mail using Mac OS10.68 as my default mail program for sending pdfs directly from the pdf panel. I am having trouble with Apple Mail (this issue has nothing to do with sending pdfs) and have tried several other email clients