Script to make a file inventory on a file server
Hello
To accomplish a company audit, I have to create a script that scan our windows 2003 standard file server and create a report with a list of certain files type like mp3, video and so on. In the list have to be present path, file name, and file owner.
I already searched on Google, but I don't find anything usable.
Someone could help me ?
Thanks
Raven
I like that, except I'd change out FullName for Directory and maybe add the size, which is usually helpful in a storage audit.
$searchdir = "d:\ShareRoot","e:\ShareRoot"
$ext = "*.mp3","*.wma" ## etc etc
$searchdir | % { gci $_ -recurse -include $ext | select Name,Directory,@{Name="Size in MB";expression={$_.Length / 1mb}},@{Name="Owner";expression={$_.getaccesscontrol().Owner}}} | Export-Csv C:\DirResult.csv -notype
Thanks, this is a very useful script. How could the output be amended to also include file creation and modification date?
Similar Messages
-
How do I make a batch file if the .class file uses a foreign package?
I am trying to make an MS-DOS batch file using the bytecode file from the Java source file, called AddFields.java. This program uses the package BreezySwing; which is not standard with the JDK. I had to download it seperately. I will come back to this batch file later.
But first, in order to prove the concept, I created a Java file called Soap.java in JCreator. It is a very simple GUI program that uses the javax.swing package; which does come with the JDK. The JDK is currently stored in the following directory: C:\Program Files\Java\jdk1.6.0_07. I have the PATH environment variable set to the 'bin' folder of the JDK. I believe that it is important that this variable stay this way because C:\Program Files\Java\jdk1.6.0_07\bin is where the file 'java.exe' and 'javac.exe' are stored. Here is my batch file so far for Soap:
@echo off
cd \acorn
set path=C:\Program Files\Java\jdk1.6.0_07\bin
set classpath=.
java Soap
pause
Before I ran this file, I compiled Soap.java in my IDE and then ran it successfully. Then I moved the .class file to the directory C:\acorn. I put NOTHING ELSE in this folder. then I told the computer where to find the file 'java.exe' which I know is needed for execution of the .class file. I put the above text in Notepad and then saved it as Soap.bat onto my desktop. When I double click on it, the command prompt comes up in a little green box for a few seconds, and then the GUI opens and says "It Works!". Now that I know the concept of batch files, I tried creating another one that used the BreezySwing package.
After I installed my JDK, I installed BreezySwing and TerminalIO which are two foreign packages that make building code much easier. I downloaded the .zip file from Lambert and Osborne called BreezySwingAndTerminalIO.zip. I extracted the files to the 'bin' folder of my JDK. Once I did this, and set the PATH environment variable to the 'bin' folder of my JDK, all BreezySwing and TerminalIO programs that I made worked. Now I wanted to make a batch file from the program AddFields.java. It is a GUI program that imports two packages, the traditional GUI javax.swing package and the foreign package BreezySwing. The user enters two numbers in two DoubleField objects and then selects one of four buttons; one for each arithmetic operation (add, subtract, multiply, or divide). Then the program displays the solution in a third DoubleField object. This program both compiles and runs successfully in JCreator. So, next I moved the .class file from the MyProjects folder that JCreator uses to C:\acorn. I put nothing else in this folder. The file Soap.class was still in there, but I did not think it would matter. Then I created the batch file:
@echo off
cd \acorn
set path=C:\Program Files\Java\jdk1.6.0_07\bin
set classpath=.
java AddFields
pause
As you can see, it is exactly the same as the one for Soap. I made this file in Notepad and called it AddFields.bat. Upon double clicking on the file, I got this error message from command prompt:
Exception in thread "main" java.lang.NoClassDefFoundError: BreezySwing/GBFrame
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Caused by: java.lang.ClassNotFoundException: BreezySwing.GBFrame
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 12 more
Press any key to continue . . .
I know that most of this makes no sense; but that it only means that it cannot find the class BreezySwing or GBFrame (which AddFields extends). Notice, however that it does not give an error for javax.swing. If I change the "set path..." command to anything other than the 'bin' folder of my JDK, I get this error:
'java' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
I know this means that the computer cannot find the file 'java.exe' which I believe holds all of the java.x.y.z style packages (native packages); but not BreezySwing or any other foreign packages. Remember, I do not get this error for any of the native Java packages. I decided to compare the java.x.y.z packages with BreezySwing:
I see that all of the native packages are not actually visible in the JDK's bin folder. I think that they are all stored in one of the .exe files in there because there are no .class files in the JDK's bin folder.
However, BreezySwing is different, there is no such file called "BreezySwing.exe"; there are just about 20 .class files all with names like "GBFrame.class", and "GBActionListener.class". As a last effort, I moved all of these .class files directly into the bin folder (they were originally in a seperate folder called BreezySwingAndTerminalIO). This did nothing; even with all of the files in the same folder as java.exe.
So my question is: What do I need to do to get the BreezySwing package recognized on my computer? Is there possibly a download for a file called "BreezySwing.exe" somewhere that would be similar to "java.exe" and contain all of the BreezySwing packages?There is a lot of detail in your posts. I won't properly quote everything you put (too laborious). Instead I'll just put your words inside quotes (").
"..there are some things about the interface that I do not like."
Like +what?+ This is not a help desk, and I would appreciate you participating in this discussion by providing details of what it is about the 'interface' of webstart that you 'do not like'. They are probably misunderstandings on your part.
"Some of the .jar files I made were so dangerously corrupt, that I had to restart my computer before I could delete them."
Corrupt?! I have never once had the Java tools produce a corrupt Jar. OTOH, the 'cannot delete' problem might relate to the JRE gaining a file lock on the archive at run-time. If the file lock persisted after ending the app., it suggests that the JRE was not properly shut down. This is a bug in the code and should be fixed. Deploying as .class files will only 'hide' the problem (from casual inspection - though the Task Manager should show the orphaned 'java' process).
"I then turned to batch files for their simple structure and portability (I managed to successfully transport a java.util containing batch file from my computer to another). This was what I did:
- I created a folder called Task
- Then I copied three things into this folder: 1. The file "java.exe" from my JDK. 2. The program's .class file (Count.class). and 3. The original batch file.
- Then I moved the folder from a removable disk to the second computer's C drive (C:\Task).
- Last, I changed the code in the batch file...:"
That is the +funniest+ thing I've heard on the forums in the last 72 hours. You say that is easy?! Some points.
- editing batch files is not scalable to 100+ machines, let alone 10000+.
- The fact that Java worked on the target machine was because it was +already installed.+ Dragging the 'java.exe' onto a Windows PC which has no Java will not magically make it 'Java enabled'.
And speaking of Java on the client machine. Webstart has in-built mechanisms to ensure that the end user has the minimum required Java version to run the app. - we can also use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] on the original web page, to check for minimum Java before it puts the link to download/install the app. - if the user does not have the required Java, the script should guide them through installing it.
Those nice features in deployJava.js are available to applets and apps. launched using webstart, but they are not available for (plain) Jar's or loose class files. So if 'ensuring the user has Java' is one of the requirements for your launch, you are barking up the wrong tree by deploying loose class files.
Note also that if you abandon webstart, but have your app. set up to work from a Jar, the installation process would be similar to above (though it would not need a .bat file, or editing it). This basic strategy is one way that I provide [Appleteer (as a downloadable ZIP archive)|http://pscode.org/appleteer/#download]. Though I side-step your part 1 by putting the stuff into a Jar with the path Appleteer/ - when the user expands the ZIP, the parts of the app. are already in the Appleteer directory.
Appleteer is also provided as a webstart launched application (and as an applet). Either of those are 'easier' to use than the downloadable ZIP, but I thought I would provide it in case the end user wants to save it to disk and transport the app. to a machine with no internet connection, but with Java (why they would be testing applets on a PC with no internet connection, I am not sure - but the option is there).
"I know that .jar and .exe files are out because I always get errors and I do not like their interfaces. "
What on earth are you talking about? Once the app. is on-screen, the end user would not be able to distinguish between
1) A Jar launched using a manifest.
2) A Jar launched using webstart.
3) Loose class files.
Your fixation on .bat files sounds much like the adage that 'If the only tool you have is a hammer, every job starts to look like a nail'.
Get over them, will you? +Using .bat files is not a practical way to provide a Java app. to the end user+ (and launching an app. from a .bat looks quite crappy and 'second hand' to +this+ user).
Edit 1:
The instructions for running Appleteer as a Jar are further up the page, in the [Running Appleteer: Application|http://pscode.org/appleteer/#application] section.
Edited by: AndrewThompson64 on May 19, 2009 12:06 PM -
Hello Everybody, and thank you very much if you can answer to my little problem
So here is the beginning of my script. At the end it will be a script to batch convert Psd files to jpeg in different resolutions, in different folders.
I wanted to understand subtlety some parts of applescript, but I have to say that I failed for this case.
So the part I am looking for is to compare files between two folders, not exactly like syncing.
In the first Folder, psds files.
In the second, Jpgs, wich have been made from the psds, with a 2nd part of the script, batch to jpeg.
I want to compare these files to tell the 2nd script not to batch them to jpeg if they have not been modified.
So the steps I would like to write :
tell applescript to :
1 -
get every files of folder "psd" without invisibles
get only the names of these files without extension
get the modification date of these files
2-
get every files of folder "jpg" without invisibles
get only the names of these files without extension
get the modification date of these files
3- compare the names of the files in psd's and jpg's folders (it's why I didn't want the extension)
if some or all Psds already exist in jpg folder, then
compare the modification dates of these same files
and if these files in psd folder are more recent than in jpeg folder, then
get only these modified files in psd folder, and, also the new ones (not existing in jpg folder).
and --
4 - launch my batchconverttojpg for this result
(at this moment I only want to find steps 1, 2 and 3)
--- It is important for me to do that, because the files in psd's folder will always change, and I can have really big files (like 500 or 800 mo each), and it will be really faster to batch only modified files…
--- Here is the beginning of the script I am writing, but … bug bug bug, I don't find the good way to write that…
set folder1 to "Macintosh HD:Users:Me:Desktop:test batch convert-script:psds" as string
set folder2 to "Macintosh HD:Users:Me:Desktop:test batch convert-script:jpegs:Jpegs" as string
set AppleScript's text item delimiters to ""
tell application "System Events"
set imgsources to every file of folder folder1 whose name does not start with "." and (file type is "psd" or file type is "JPG" or name extension is "psd" or name extension is "jpg")
set imgcibles to every file of folder folder2 whose name does not start with "." and (file type is "psd" or file type is "JPG" or name extension is "psd" or name extension is "jpg")
end tell
--tell application "Finder"
repeat with i from 1 to the count of imgsources without invisibles
set img to (item i of imgsources as alias)
set infosource to info for img
set nameimg1 to name of infosource -- recupere le nom de limage + extension
--set extimg2 to items -1 thru -4 of nameimg2 as text -- recupere l'extension
set nimg1 to items 1 thru -5 of nameimg1 as text -- recupere le nom
set moddateimg1 to modification date of infosource -- recupere la date de modif
repeat with i from 1 to the count of imgcibles without invisibles
set img2 to (item i of imgcibles as list) -- recupere tous les elements du dossier
set infocible to info for img2 -- recupere les infos
set nameimg2 to name of infocible -- recupere le nom de limage de destination
set extimg2 to items -1 thru -4 of nameimg2 as text -- recupere l'extension
set nimg2 to items 1 thru -5 of nameimg2 as text -- recupere le nom
set moddateimg2 to modification date of infocible -- recupere la date de modif
tell application "Finder"
if nimg1 = nimg2 as text then
--set nimg1 to nimg1 as string
--set nimg2 to nimg2 as string
--set name of img2 to folder2 & ":" & nimg2 & "-" & "2" & extimg2 as text
set name of img2 to nimg2 & "-" & "2" & extimg2
-- I am just trying to rename the file at this step.
-- After this, I will compare the dates, and then, batch convert.
end if
end tell
end repeat
end repeat
So if one of you have the good solution It will be a miracle for me
I have to say that if I wrote this script in a simple way like that, it's to be able to understand what I do, or to understand the script after 6 month, without thinking about it…
Thank you very much for your answers
FredOk so there are a lot of things I didn't know about some details… And I see that I will never have succeed to write something like that…
I don't really understand why to "set psdNames to --> {}" this last detail is unknown for me…
And if I understand, the thing I missed is to do a listindex of the items ? it's why I didn't succeed to compare the files ?
Then I though that it could be interesting for you or differents users to see the result. I think it works perfectly now.
Of course, I am not professional in applescript editing, so if you have some comments or modifications, do not hesitate to post them here
Thanks again to Red_Menace !
Fred
Here it is :
(sorry I didnt translate all the notes to English. Just have to know that the script proceed in the folder where it is. If it's not save in the good folder before execute, or save as application in the good folder, then it will proceed in the default folder "applications"... so careful
display dialog " Attention, Le script va créer un dossier psd, et déplacer les fichiers psds ici dans ce nouveau dossier" & return & " Et va ensuite procéder à la création de" & return & " Jpegs dans différents dossiers" buttons {"Ok", "Annuler", "+ d'explications"} default button "OK"
if button returned of the result is "+ d'explications" then
explications()
return
end if
--Application utilisée : adobe photoshop CS3
--Changer la version si besoin dans les lignes ci dessous
--Changer le nom des dossiers ici, sans avoir à changer le reste du script
set nomdossierpsds to "psds"
set psdsFolder to nomdossierpsds
set tempFolderName to "Exports"
set tempfoldername1 to "Jpegs_HD"
set tempfoldername2 to "Jpegs_SD"
--Pour changer la taille des Jpegs SD --
set choixtaille to "1200"
tell application "Finder"
set racine to get folder of (path to me) as Unicode text
set nomprojet to name of folder racine
--if folder psd exists but with different case
if exists folder "psd" in folder racine then
set name of folder "psd" in folder racine to psdsFolder
end if
if exists folder "Psd" in folder racine then
set name of folder "psd" in folder racine to psdsFolder
end if
if exists folder "Psds" in folder racine then
set name of folder "Psds" in folder racine to psdsFolder
end if
--2 -- check si le dossier psd existe, sinon le crée.
if not (exists folder psdsFolder in folder racine) then
make new folder in folder racine with properties {name:psdsFolder}
set psdsFolder to folder psdsFolder in folder racine as alias
open folder psdsFolder
--display dialog "Avant de Continuer, Placer les images dans le dossier Psds" buttons {"Annuler"} default button 1
else
set psdsFolder to folder (racine & "psds") as alias
end if
--if Psd folder didnt exists, then move psd files in
set psds to (files of folder racine whose name extension is "psd")
move psds to folder psdsFolder
--Dossier Jpegs Racine -- outputFolder -- check si present sinon creation
if not (exists folder ((racine as string) & tempFolderName)) then
set outputFolder to make new folder at racine with properties {name:tempFolderName}
else
set outputFolder to folder ((racine as string) & tempFolderName)
end if
--Dossier Jpegs HD -- outputFolder1 pour photoshop -- check si present sinon creation
if not (exists folder (((racine as string) & tempFolderName as string) & ":" & tempfoldername1)) then
set outputFolder1 to make new folder at outputFolder with properties {name:tempfoldername1}
else
set outputFolder1 to folder ((racine as string) & tempFolderName & ":" & tempfoldername1)
end if
set outputFolder1 to outputFolder1 as alias
--Dossier Jpegs SD -- outputFolder2 pour photoshop -- check si present sinon creation
if not (exists folder (((racine as string) & tempFolderName as string) & ":" & tempfoldername2)) then
set outputFolder2 to make new folder at outputFolder with properties {name:tempfoldername2}
else
set outputFolder2 to folder ((racine as string) & tempFolderName & ":" & tempfoldername2)
end if
set outputFolder2 to outputFolder2 as alias
end tell
--recupere le chemin du dossier des psds à procéder
tell application "Finder"
set psdsFolder to folder (racine & nomdossierpsds) as alias
end tell
--1
tell application "Finder" -- get file items from the folders (coerce list items to aliases for use later)
set psdFiles to (files of folder psdsFolder whose name extension is "psd") as alias list
set jpgFiles to (files of folder outputFolder1 whose name extension is "jpg" or name extension is "psd") as alias list
end tell
--2
set psdNames to {} -- get the psd file names (these are in the same order as the file items)
repeat with anItem in psdFiles
set the end of psdNames to (justTheName from anItem)
end repeat
set jpgNames to {} -- get the jpg file names (these are in the same order as the file items)
repeat with anItem in jpgFiles
set the end of jpgNames to (justTheName from anItem)
end repeat
--3
set filesList to {} -- figure out the files to process
repeat with X from 1 to (count psdNames)
set theName to contents of (item X of psdNames) -- get a name from the psd list
if theName is in jpgNames then -- found a jpg match, so check the date
set match to (listIndex of theName from jpgNames) -- get the index of the matching name
tell application "Finder" -- look up the file items for the matching names and get the dates
set psdDate to modification date of (item X of psdFiles)
set jpgDate to modification date of (item match of jpgFiles)
end tell
if psdDate > jpgDate then set the end of filesList to (item X of psdFiles) -- newer file, so add
else -- no match, so add
set the end of filesList to (item X of psdFiles)
end if
end repeat
filesList --> this list contains items (aliases) that are not in jpgsFolder or have a newer modification date
tell application "Adobe Photoshop CS3"
activate
set display dialogs to never
close every document saving no
end tell
repeat with aFile in filesList
set fileIndex to 0
tell application "Finder"
-- The step below is important because the 'aFile' reference as returned by
-- Finder associates the file with Finder and not Photoshop. By converting
-- the reference below 'as alias', the reference used by 'open' will be
-- correctly handled by Photoshop rather than Finder.
set theFile to aFile as alias
set theFileName to name of theFile
end tell
tell application "Adobe Photoshop CS3"
activate
open theFile
set docRef to the current document
set docHeight to height of docRef
set docWidth to width of docRef
------------------------------------------------------------------- 1st Export to jpeg
--Convert the document to a document mode that supports saving as jpeg
flatten docRef
tell docRef to convert to profile "sRGB IEC61966-2.1" intent perceptual with dithering and blackpoint compensation
if (bits per channel of docRef is sixteen) then
set bits per channel of docRef to eight
end if
--The first copy is simply saved with additional document info added
set infoRef to get info of docRef
set copyright notice of infoRef to "Copyright Frédéric Perrin"
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
--set fileIndex to fileIndex + 1
set newFileName to (outputFolder1 as string) & docBaseName & ".jpg"
save docRef in file newFileName as JPEG appending lowercase extension with options {class:JPEG save options, quality:12, format options:optimized}
------------------------------------------------------------------- 2nd export to jpeg
-- The second copy is saved resized to width of 100 pixels proportionally
-- There is no scale constraint in the resize image command.
-- Use the height/width ratio to simulate the option.
set ruler units of settings to pixel units
set type units of settings to pixel units
resize image current document width choixtaille height (choixtaille * docHeight / docWidth)
-- repete la mise en memoire des variables, sinon des bugs
set docRef to the current document
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
--set fileIndex to fileIndex + 1
set newFileName2 to (outputFolder2 as string) & docBaseName & "-" & choixtaille & ".jpg"
save docRef in file newFileName2 as JPEG appending lowercase extension --with options {class:JPEG save options, quality:12, format options:optimized}
-- The original document is closed without saving so it remains as it was
-- when opened for batch processing
close current document without saving
end tell
end repeat
-- Routines
-- Returns the document name without extension (if present)
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseName
on justTheName from someFile
get the name from a file path
parameters - someFile [various]: a complete file path (POSIX or Finder)
returns [text] - the base file name
set someFile to someFile as text
tell application "System Events" to tell disk item someFile
set {theName, theExtension} to {name, name extension}
end tell
if theExtension is in {missing value, ""} then
set theExtension to ""
else
set theExtension to "." & theExtension
end if
return text 1 thru -((count theExtension) + 1) of theName -- just the name part
end justTheName
to listIndex of anItem from someList
get the (first) index of anItem in someList
parameters - anItem [various]: the item to look for
someList [list]: the list to look in
returns [integer]: the index (0 if not found)
set theIndex to 0
repeat with X from 1 to (count someList)
if (contents of (item X of someList)) is anItem then
set theIndex to X
exit repeat
end if
end repeat
return theIndex
end listIndex
on explications()
tell application "TextEdit"
activate
make new document
set text of front document to ¬
"--- Attention --- Le Script se lance pour gérer le dossier dans lequel il se trouve." & return & return & ¬
"Pour ne plus voir ce message, ouvrir le script/application et l'éditer avec un éditeur comme Editeur applescript : Effacer alors le premier paragraphe --> End Message" & return & return & return & ¬
"Il vérifie l'existence d'un dossier Psd, s'il existe, mais pas dans la bonne casse, renomme le dossier --" & return & "Donc -- attention -- si d'autres scripts sont chainés à ce dossier, il faudra mettre à jour la casse ou orthographe, sinon changer les variables en début de script afin que tous les scripts marchent avec le meme nom de ce dossier psd" & return & return & ¬
"Une fois cela géré, le dossier -psds- est créé, sil n'est pas deja la. Les fichiers psds pouvant être présents à la racine du dossier, où se trouve le script, seront déplacés dans le dossier psd" & return & ¬
"Ensuite, création d'un dossier jpeg contenant deux autres dossiers : jpgs HD et Sd, le 1er contiendra les jpegs à la resolution source du psd, le dossier Sd à la résolution de 1200px, soit acceptable pour le web ou le partage temporaire" & return & return & ¬
"Pour finir, le script peut être relancé à l'infini, les dossiers se synchronisent en fonction du dossier Psd et JpegsHD. Si de nouveaux fichiers se trouvent dans le dossier Psd, ou bien sils ont été modifiés, alors ils seront re-batchés en jpegs dans les dossiers correspondants." & return & ¬
"Donc -- Attention -- , ne jamais faire de retouches sur les fichiers Jpegs, seulement sur les psds, et -- attention-- aussi, les fichiers jpegs correspondants aux psds retouchés seront écrasés" & return & ¬
"Pour conserver des versions des fichiers, à la main, renommer séquentiellement les psds à l'enregistrement dans photoshop, ainsi les jpegs seront séquentiels aussi" & return & return & return & ¬
"La préférence, de choisir à la main la séquence des fichiers psds semble être plus pratique à l'usage, et de garder un minimum la main sur les images, afin de s'y retrouver" & return & return & return
end tell
end explications
------------------------------------------------------------------- -
Move group of pages from one InDesign file to another InDesign File using VB.Script
Dear team,
I am trying to move group of InDesign pages from one indesign file to another indesign file using vb.script.
I have written the code like
Dim Pages=IndDoc.Pages
Dim Mytype=TypeName(Pages)
Pages.Move(InDesign.idLocationOptions.idBefore,IndDoc1.Pages.LastItem)
but it is giving an error as method Move is not a member of Pages
please give mme the solution to move the Multiple pages or a group of page from one Indd to another Indd.Hey Peter, if I wan to move several page that part of Auto Flow text, I checked the "delete page after moving" but the content still there, not deleted.
Is there any way to delete it automatically, just to make sure I have moved that autoflowed page? -
To create a script and schedule which purge 30 days old files
Hi Friends,
Very new in Unix and i got a requirement like writing a script and schedule it, so that it removes 30 days old files from all the log locations of a unix box.
Suppose i have a unix server ltbamdev1 and in this server i have a mount point opt/bam. In this mount point i have 3 different folders like
/ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/opmn/logs
/ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/bpel/domains/default/logs
/ltbamdev1/oracle/install/product/10.1.3.1/OracleAS_1/bpel/domains/support/logs
Please help me in writing a script which runs once a week and removes all 30 days old files from these three folder locations.
Thanks in advance
DuosModerator Action:
The discussion is in the duplicate cross-post:
To create a script and schedule which purge 30 days old files
@O.P.
For the future, only make one post.
If it is in the wrong forum, it will likely get relocated by moderators.
This duplicate is now locked to prevent responses getting fragmented all over the place. -
TIPS(20) : MAKE A MAP OF YOUR ORACLE FILES
제품 : SQL*PLUS
작성날짜 : 1996-11-12
TIPS(20) : Make a Map of Your Oracle Files
==========================================
The script below generates a report on all the Oracle files
(database, redo log, and control) in an Oracle UNIX system.
It's like a map of your Oracle files. Moreover, it also makes available other
information (size and physical I/Os, if applicable) related to the files.
THE SCRIPT
rem
rem File: filemap.sql
rem
rem This script provides information on the location/path, file name,
rem size and physical I/Os (if applicable) of all the Oracle files
rem (database, control and redo log) in an Oracle/UNIX platform.
rem
rem
set pages 999
col path format a20 heading 'Path'
col fname format a15 heading 'File Name'
col fsize format 999b heading 'M bytes'
col pr format 999999b heading 'Phy. Reads'
col pw format 999999b heading 'Phy. Writes'
break on path skip 1
spool zzfilemap.rep
select substr(name,1,instr(name, '/', -1)-1 ) path,
substr(name,instr(name, '/', -1)+1 ) fname,
bytes/1048576 fsize,
phyrds pr,
phywrts pw
from v$datafile df, v$filestat fs
where df.file# = fs.file#
UNION
select substr(name,1,instr(name, '/', -1)-1 ) path,
substr(name,instr(name, '/', -1)+1 ) fname,
0 fsize,
0 pr,
0 pw
from v$controlfile
UNION
select substr(lgf.member,1,instr(lgf.member,'/', -1)-1) path,
substr(lgf.member,instr(lgf.member, '/', -1)+1 ) fname,
lg.bytes/1048576 fsize,
0 pr,
0 pw
from v$logfile lgf, v$log lg
where lgf.group# = lg.group#
order by 1,2
spool off
exit
--------------------------Sample Output----------------------------------
Path File Name M bytes Phy. Reads Phy. Writes
/u01/oradata/PDB7 control3.ctl
rdmxf1.dbf 50 694 2781
redo1b.log 10
redo2b.log 10
redo3b.log 10
tempf1.dbf 30
/u02/oradata/PDB7 control1.ctl
rbsf1.dbf 40 6 2813
redo1a.log 10
redo2a.log 10
redo3a.log 10
/u03/oradata/PDB7 control2.ctl
genf1.dbf 50 1551 396
rdmf1.dbf 100 4403 2335
systemf1.dbf 50 5905 1116
toolsf1.dbf 15 2979
16 rows selected.Thanks for your reply, but I'm not sure if you understood my point correctly.
I didn't exactly mean to use my iPod as a USB memory stick.
What I meant was that if I copied the contents of my iPod to a DVD and if something weird happened to my music player and I would have to format it...
Could I then just copy the files (I had burned on the DVD) back to my iPod and it would be the same as before? My music would be saved? -
in Forms Central, attempting to do file attachment, but "select File" option is grayed lout/unavailable - how do I make it available?
Is it necessary that all the files are on the local hard disks? In the case of the laptop I could understand this if the laptop is also used outside the network, but the desktops should stay in place, no?
It could be as easy as to make a shortcut on all the computers to the samba-share and tell the inlaws that they have to use the samba-share to store their (shared) files.
You are correct about this but I doubt they would remember to use this all the time so I want to sync the folders just in case.
Assuming the laptop is always going to be in the same IP address when it connects to the network (which is unlikely in default configurations), you could create a script that checks for the existence of the machine on the network then perform a sync. I had a script written in Python somewhere that would check to make sure the server side was up and run unison, but it could be modified to check for the laptop and copy files. Let me know if that's something you're interested in and I can post it for you.
This sounds like what I'm looking for. Also I wander If it could be done by NetBIOS name instead of ip address? This way It wouldn't matter.
The script sounds like what I'm looking for though
Thanks for the help! -
A script to make all page references into hyperlinks
Hi,
I have a customer request to make all pages references into hyperlinks.
For example: when you see in the text of the PDF "page 4", you can click on it and move to page 4. This of course can be done manually with InDesign. The problem starts when you have whole load of them. In addition to that, I have this project as a book, with several different documents...
I used the script "Automatic hyperlink of each word in a file" from http://www.nobrainer.dk/automatic-hyperlink-of-each-word-in-a-file/ as a base, and modified it for my porpuse. Currently it still produces errors. Any idea what's the bug?
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var myHyperlinkStyle = myDocument.characterStyles.item("hyperlink"); // replace hyperlink with name of your char style for links
//alert(myHyperlinkStyle);
main();
} else {
alert("Please open a document");
function main() {
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//the value to find
myFindVal = "page (\\d+)";
doSearchAndReplace(myFindVal, app.activeDocument);
// reset search
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
function doSearchAndReplace(stringfind, searchin) {
app.findGrepPreferences.findWhat = stringfind;
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = true;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
var myFoundItems = searchin.findGrep();
for (i = 0; i < myFoundItems.length; i++) {
var item = myFoundItems[i].contents;
//the destination page
var destPage = item.slice(5);
var myHyperlinkDestination = myMakeHyperlinkDestination(destPage);
myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
try {
var myHyperlinkTextSource = myDocument.hyperlinkTextSources.add(myFoundItem);
var myHyperlink = myDocument.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
myHyperlink.visible = false;
catch(myError){
function myMakeHyperlinkDestination(myDestPage){
//If the hyperlink destination already exists, use it;
//if it doesn't, then create it.
try{
var myHyperlinkDestination = myDocument.hyperlinkDestinations.item(myDestPage);
myHyperlinkDestination.name;
catch(myError){
myHyperlinkDestination = myDocument.hyperlinkPageDestinations.add(myDestPage);
myHyperlinkDestination.destinationPage = myDestPage;
myHyperlinkDestination.name = myDestPage;
//Set other hyperlink properties here, if necessary.
return myHyperlinkDestination;well, after some more digging into it, I found the bugs and corrected, here is the corrected version (now I only need to figure out how to do it on an entire book...):
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var myHyperlinkStyle = myDocument.characterStyles.item("hyperlink"); // replace hyperlink with name of your char style for links
//alert(myHyperlinkStyle);
main();
} else {
alert("Please open a document");
function main() {
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//the value to find
myFindVal = "page (\\d+)";
doSearchAndReplace(myFindVal, app.activeDocument);
// reset search
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
function doSearchAndReplace(stringfind, searchin) {
app.findGrepPreferences.findWhat = stringfind;
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = true;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
var myFoundItems = searchin.findGrep();
for (i = 0; i < myFoundItems.length; i++) {
var item = myFoundItems[i].contents;
//the destination page
var destPageNumber = item.slice(5);
var destPage = searchin.pages.itemByName(destPageNumber);
var myHyperlinkDestination = myMakeHyperlinkDestination(destPage);
myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
try {
var myHyperlinkTextSource = myDocument.hyperlinkTextSources.add(myFoundItem);
var myHyperlink = myDocument.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
myHyperlink.visible = false;
catch(myError){
function myMakeHyperlinkDestination(myDestPage){
//If the hyperlink destination already exists, use it;
//if it doesn't, then create it.
try{
var myHyperlinkDestination = myDocument.hyperlinkDestinations.item(myDestPage);
myHyperlinkDestination.name;
catch(myError){
myHyperlinkDestination = myDocument.hyperlinkPageDestinations.add(myDestPage);
myHyperlinkDestination.destinationPage = myDestPage;
//myHyperlinkDestination.name = myDestPage.name;
//Set other hyperlink properties here, if necessary.
return myHyperlinkDestination; -
How to make applescript to select every 3rd file to move to new folder?
I have an interesting 'problem' I think.
As a result of a time-lapse experminent, I have a folder which holds several thousands of pictures from a fixed point, made over several days & nights.
But there is one issue: the camera made 3 different exposures every 5 seconds.
This resulted in every 3rd picture 'belonging' to each other. So these have to be selected for going in a seperate folder. Menaing: pictures 1 and 4 and 7 and 10 .... they must go in one folder. 2 and 4 and 8 and 11.. in the second folder. Finally 3 and 5 and 9 and 12 in a third folder.
How to do this with software (to avoid injury) because of the thousands of pics.
Is this do-able with applescript? How?
TnxHello
You may try something like the following script.
Main part is written in shell script for performance sake. AppleScript is only used for user interface.
Please see comments in script for its usage and behaviour.
And please test the script first with small subset of your images.
(Since the script will scan the source folder tree for image files, it is good idea not to create destination folders in source folder tree.)
Minimally tested with OSX10.2 at hand but NO WARRANTIES of any kind.
Make sure you have full backup of your images before applying this script.
Hope this may help,
H
image file (jpg) sorter
v0.2
Script will let you choose two folders, i.e. -
a) source folder where images reside (directory tree under the chosen folder is scanned),
b) destination parent folder where three subfolders will be made (named '0', '1', '2').
The file number i is obtained by removing extension and non-digts from file name.
The file with number i (0-based) in source tree will be moved to (i mod 3)'th subfolder in destination.
e.g.,
IMG_1440.JPG -> '0' (i = 1440, i mod 3 = 0)
IMG_1441.JPG -> '1' (i = 1441, i mod 3 = 1)
IMG_1442.JPG -> '2' (i = 1442, i mod 3 = 2)
IMG_1443.JPG -> '0' ...
IMG_9997.JPG -> '1'
IMG_9998.JPG -> '2'
IMG_9999.JPG -> '0'
IMG_0001.JPG -> '1'
IMG_0002.JPG -> '2'
IMG_0003.JPG -> '0'
image file name convention : ZZZZ_9999.jpg
set src to choose folder with prompt "Choose source folder."
set src_ to (src's POSIX path's text 1 thru -2)'s quoted form
set dst to choose folder with prompt "Choose destination parent folder."
set dst_ to (dst's POSIX path's text 1 thru -2)'s quoted form
set sh to "
# source directory
srcdir=" & src_ & ";
# destination directories
dstdir=" & dst_ & ";
dest=("$dstdir"/{0,1,2});
# make destinations
mkdir -p "${dest[@]}";
# let k = number of destination directories
k=${#dest[@]};
# sort files to destinations such that -
# 1) number i is obtained by removing extension and non-digits from file name; and
# 2) file with number i is stored in (i % k)'th destination, where i is zero-based.
# e.g. Given xxxx_9999.jpg, k = 3;
# i = 9999 and the file is sorted to destination 0 (= 9999 mod 3)
find "$srcdir" -type f -iname '*.jpg' -print0 | while read -d $'\0' f;
do
leaf=${f##*/}; # get file name
stem=${leaf%.*}; # remove extension
i=${stem//[^0-9]/}; # remove non-digts from file name
let i=0+10#$i; # to interpret, e.g., 010 as 10, otherwise 010 is treated as octal.
# echo "$i $f ${dest[i % k]}"; # for testing
mv "$f" "${dest[i % k]}"; # move file
done
do shell script sh
display dialog "Done" with icon 1 giving up after 20 -
Hello i need a help about script to export translatable text strings from ai files and import them back after editing, thanks in advance
Lanny -
Thank you for taking the time to help with this problem. Can I just say however that as someone who has posted a first comment here and quite clearly never used a forum like this before, your comment unfortunately comes across as very excluding. It makes me feel there are a set of unwritten rules that I should know, and that I don't know them shows that the forum is not for me. In short, it's exactly the kind of response that stops people like me using forums like this.
I'm sure it's not intended to be received like this and I am sure that the way you have responded is quite normal in the rules of a forum like this. However, it is not normal for those of us who aren't familiar with forums and who only encounter them when they have a genuine problem. This is why I hope it is helpful to respond in full.
The reason I posted here is as follows. I was directed here by the apple support website. The original comment seemed to be the only one I could find which referred to my issue. As there is no obvious guidance on how to post on a forum like this it seemed perfectly reasonable to try and join in a conversation which might solve more than one problem at once.
Bee's reply however is both helpful and warm. This could in fact be a template for how new members should be welcomed and inducted into the rules of the forum in a friendly and inclusive way. Thank you very much indeed Bee! -
How to make changes in more then one file
Hi All,
M new and dont have deep idea about dreamwheaver.Actually i want to make changes in more then one file at the same time, how to do this. Is there any option available there. ?If you you build your new site with SSIs (server-side includes), changes to include files will populate to all pages on the remote server. This is a huge time saver for maintaining common page elements on large sites.
Example code might look like this:
<body>
header goes here
<!--#include virtual="header.html"-->
<p>some text</p>
menu goes here
<!--#include virtual="menu.html"-->
<p>some text</p>
footer goes here
<!--#include virtual="footer.html"-->
</body>
</html>
Pages with includes on them need to be saved as .shtm or .shtml. If you use server-side scripts on your site, save as .asp or .php to match your script type.
http://www.smartwebby.com/web_site_design/server_side_includes.asp
Nancy O. -
Cannot get Software Files Inventory
Hi All
I am trying to do a software files inventory to then create some local Apps but even though under the inventory configuration I have ticked the option, after doing an inventory scan I do a software files report and it says 0 machines inventoried. the version is 10.1.2.
Thanks
MagteqMagteq,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://support.novell.com and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/ -
Just paid $6.99 for iPad highlighter at App Store. I can find no way to make it work in the iPad file when I call it up. It just sits there like any other app. Thanx in advance for the help. [email protected]
See if the developer has a website with intstructions. Check around in the app for instructions. They're often under settings. Contact the developer.
-
How to make view Java Bean as .ocx file.
Hi All,
I want to use a visual Java Bean in Visual basic. So that I can modify all the bean properties as modify properties in a ocx file.
I used ActiveX Com bridge downloaded from Sun's site. But the packager
makes a .tlb file .
This file can only be added as a reference in visual basic but not as a ActiveX control. Is there any way out to do that???
Thanks & regards.
NimeshThe packager creates a registry file and a tlb file.
After registering this .reg file, java bean can be used as an ActiveX control.
From within Visal Basic, select the "Tools" menu and "Custom Controls" item and add the Bean control that was generated.
Avinash. -
Is there a way to run a script to create an RPD file from MDS XML files
We would be interested in using the MDS XML format for the RPD file in saving it in our Subversion source code control system, and I have seen how to do this in the User documentation.
Our question is whether or not there is a way to use a command line tool to recreate the rpd file without having to use the Admin tool, so that we can automate the deployment of the RPD file from source code control to QA and Production environments.
If we check in the RPD file directly, then there is a way to automate the process, but we would prefer to use the MDS XML format since this allows us to save changes in text format, not binary, but we still need to be able to automate the process.
In the Oracle Fusion Middleware XML Schema Reference for Oracle Business Intelligence Enterprise Edition document, I have found that there is a way to automate the creation of the MDS XML files from an RPD file using this command:
biserverxmlgen -M -R repository_pathname [-P password] -D output_directory [-8] [-N] [-Q|-S]
So my question is basically is there a way to reverse this process, to use some command line tool (or Weblogic Scripting or some other mechanism) to create the RPD file from the MDS XML files? Are there options on the biserverxmlexec command that will do what I am asking?Hey dmfairley,
Thanks for the question. You can absolutely export the project as .mp3, as outlined in this resource:
GarageBand Help: Export songs to disk
http://help.apple.com/garageband/mac/10.0/#gbnd7cbf5ed9
Export songs to disk
You can export a project to your computer as a stereo audio file.
Exported files can be reused in GarageBand to save processing resources by replacing or bypassing multiple regions, instruments, and effects. They can also be used with other music applications and devices, posted on the Internet (on a webpage, or in the iTunes Store, for example), added to an iTunes playlist, or uploaded to a mobile device such as iPhone or iPad.
1. Choose Share > Export Song to Disk.
2. To rename the exported file, select the name in the Save As field, then enter a new name.
3. Choose a location to save the exported file from the Where pop-up menu.
4. Select the format for the exported file (AAC, MP3, or AIFF).
5. Choose the quality setting for the exported file from the Quality pop-up menu.
6. Click Export.
Thanks,
Matt M.
Maybe you are looking for
-
I've got a new 27-Inch iMac 2.66GHz Intel Core i5 with 4 GB RAM, less than a month old. I'm noticing that I'm getting slow file transfers on two (out of four) of my USB 2 ports. I've tried two different hard drives and a USB flash memory stick and th
-
Tables lines/borders – although all formatted to the required weight in MS Word 2003, once pdfd show up as different weights and the 'heavier' line varies depending on which magnification the page is in. These lines are coloured, not automatic colour
-
I'm doing alittle research on Flex vs Silverlight - and i was wondering what level of support does Flex have from 3rd party vendors? I know there's ILOG Elixor UI components, and this Salesforce.com toolkit for Web Service API - is there a central pl
-
Call system functions from qnx or adobe flex (playbook tablet)
Hi, I want to know how to access low level functions from the adobe flex sdk. For example, how i can get disk storage or cpu information when i use only the adobe flex sdk? Thanks,
-
Displaying font names in their fonts
Hi, I wanted to display a drop down with font names.When the font name is displayed, i need the font names to appear in their respective fonts. For eg., if the font name 'Verdana' is displayed, i need it to be displyed in 'Verdana' font.