Script to set all files in a folder to "Read and Write" permissions? Please
In advance my most abject apologies for posting such a simple question. I couldn't script my way out of a paper bag, and searching and googling have failed, no doubt because I don't even have the proper keywords. :-/
The script I need is so simple that it most likely exists somewhere already. Whenever I copy image files from a DVD-ROM or CD-ROM burned on a Windows laptop to my desktop Mac, the files and folders therein are "Read Only" on my Mac. If there are many files in the folder, it's very easy to Select All and do a Get Info on multiple items, so I can rectify the situation by changing the whole set in a single step. But if I have ten files or less in a folder, each file opens an Info dialog box and that can become very tedious when I have scores of folders with nine or so files in each.
Any guidance will be much appreciated.
Message was edited by: Ramón G Castañeda
You can attach a folder action to your destination folder, for example:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into the Script Editor">
on adding folder items to ThisFolder after receiving AddedItems
repeat with AnItem in AddedItems
tell application "Finder" to set owner privileges of AnItem to read write
-- tell application "Finder" to set everyones privileges of AnItem to read write
end repeat
end adding folder items to
</pre>
... but you can also use the Inspector (option-command-i) to get a single info window for multiple items.
Similar Messages
-
Mac Mini Sever - Public Share - how enable read and write permissions for new remote files
Hi,
this Sunday a friend ask me to help hum with a problem on is Man Mini Server. He has a small office and uses the mini server to share a public folder to all his employees.
Everyone that creates a file, saves it to the public folder at the mini mac.
That problem is that, who creates the file owns it and remains with read-only permissions to everyone else. The owner has to change the file permission in order to the rest of the employees can work on it.
I do not know mac arquitecture, I only work with windows and linux, but i suspect the principles are the same.
We try to create another folder , and share it, but it happens the same. Have you any ideas on what is wrong?
I suspect it has anything to do with de file Sharing at the mini mac, but it has read and write permissions for everyone.
Thanks for your help.signed applet. You aren't going to find any easy way to distribute that policy file to users, and that policy file, if you asked me to put it on my PC, I'd tell you to take a flying leap. That would open any applet to access.
-
I have been searching high and low for this one. I have a vbscript that can successfully perform the function if one file is listed. It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
that way. However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder. At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
was executed and folder was scanned. So I am going back to the drawing board and starting from the beginning.
I also have a txt file that contains the list of string text entries I would like it to search for. Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back. The current script
I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand. It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
let it search. There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for. It is a search (read) only function, going thru the entire contents of the folder and
when done, performs the loop function and onto the next file to repeat the process until all files are searched. When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
of the overall script. Saving yet another step for me to do.
My current script is set to append to the same results file and will echo [name of file I am searching]: No errors found. Otherwise, the
output shows the filename and the string text that matched. Because the results append to it, I can only run the script against each file separately or create individual output names. I would rather not do that if I could include it all in one.
This would also free me from babysitting it and running each file script separately upon the other's completion. I can continue with my job and come back later and view the completed report all in one. So
if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence). I don't want the entire line to be listed
where the error was, just the match itself.
Example: (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line. It somehow posted the example jumbled when I listed it)
File1.txt Line 54
Job terminated unexpectedly
File1.txt Line 58 Process not completed
File1.txt
Line 101 User input not provided
File1.txt
Line 105 Process not completed
File2.txt
No errors found
File3.txt
Line 35 No tape media found
File3.txt
Line 156 Bad surface media
File3.txt Line 188
Process terminated
Those are just random fake examples for this post.
This allows me to perform analysis on a set of files for various projects I am doing. Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on. Therefore, the
line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using. Very useful.
If you know how I can successfully achieve this in one script, please share. I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
Thanks for helping.I'm sorry. I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing help with. I did have one created, but I came across one that seemed more organized than what I originally created. Later
on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly. Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
However, I could still use help on it. I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error. If I end with End, then it still gives same
results.
So to give credit where I located this:
http://vbscriptwmi.uw.hu/ch12lev1sec7.html
I then adjusted it for what I was doing.
What this does does is it searches thru log files in a directory you specify when prompted. It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file: errors.log
Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched. That way, I can go directly
to each instance for particular events if further analysis is needed later on.
So I could use help on what statement should I be closing this with. What event, events or error did I overlook that I keep getting prompted for that. Any help would be appreciated.
Option Explicit
'Prompt user for the log file they want to search
Dim varLogPath
varLogPath = InputBox("Enter the complete path of the logs folder.")
'Create filesystem object
Dim oFSO
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
'Creates the output file that will contain errors found during search
Dim oTSOut
Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
'Loop through each file in the folder
Dim oFile, varFoundNone
VarFoundNone = True
For Each oFile In oFSO.GetFolder(varLogPath).Files
'Verifies files scanned are log files
If LCase(Right(oFile.Name,3)) = "log" Then
'Open the log file
Dim oTS
oTS = oFSO.OpenTextFile(oFile.Path)
'Sets the file log that contains error list to look for
Dim oFile2
Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
'Begin reading each line of the textstream
Dim varLine
Do Until oTS.AtEndOfStream
varLine = oTS.ReadLine
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
Dim colMatches, strName, strText
Do Until oErrors.AtEndOfStream
strName = oFile2.ReadLine
objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
Set colMatches = objRegEx.Execute(varLine)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strText = strText & strMatch.Value
WScript.Echo "Errors found."
oTSOut.WriteLine oFile.Name, varLine.Line, varLine
VarFoundNone = False
Next
End If
Loop
oTS.Close
oFile2.Close
oTSOut.Close
Exit Do
If VarFoundNone = True Then
WScript.Echo "No errors found."
Else
WScript.Echo "Errors found. Check logfile for more info."
End If
End if -
Why won't my script work on all files in the folder?
Hi, below is a script I hobbled together from various sources using the search function on this forum. It is supposed to change hyphens to en-dashes in a ai files in a folder. However, when I run it, it only works on one file. After it makes the change and closes the first file, it stops. Can anyone help me troubleshoot and fix the problem?
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pdfSaveOpts;
sourceFolder = Folder.selectDialog;
if ( sourceFolder != null )
files = new Array();
fileType = "*.ai";
files = sourceFolder.getFiles( fileType );
if ( files.length > 0 )
destFolder = sourceFolder;
for ( i = 0; i < files.length; i++ )
sourceDoc = app.open(files[i]); // returns the document object
var active_doc = app.activeDocument;
var search_string = '-';
var replace_string = "\u2013";
var text_frames = active_doc.textFrames;
if (text_frames.length > 0)
for (var i = 0 ; i < text_frames.length; i++)
var this_text_frame = text_frames[i];
var new_string = this_text_frame.contents.replace(search_string, replace_string);
if (new_string != this_text_frame.contents)
this_text_frame.contents = new_string;
sourceDoc.save();
sourceDoc.close();no easy way as you may wish, but not as difficult either. For eps files, you have to use SaveAs() method,
if ai - do save
if eps - do saveAs
here's a sample from the Documentation, or search the forum for other samples
// Exports current document to destFile as an EPS file with specified
// options, destFile contains the full path including the file name
function exportFileAsEPS (destFile) {
var newFile = new File(destFile);
var saveDoc;
if ( app.documents.length == 0 )
saveDoc = app.documents.add();
else
saveDoc = app.activeDocument;
var saveOpts = new EPSSaveOptions();
saveOpts.cmykPostScript = true;
saveOpts.embedAllFonts = true;
saveDoc.saveAs( newFile, saveOpts ); -
Script to copy current files from one folder to another and to FTP it to a another server
I have created a simple script that copies the file, but doesn't give me only the current day file. I'm not sure what I'm doing wrong.
:: @echo off
setlocal
:: Checking for production cluster
if not exist e: exit
date /t
for /f "tokens=1-4 delims=/ " %%A in ('date /t') do (
set M=%%B
set D=%%C
set Y=%%D)
xcopy E:\ACHDlrPPcsvDownload\*-%Y%%M%%D%*-GMACTEST.csv /y E:\ACHDLRCSV
pause
endlocal
I also want to ftp this file to another server. I've tried the basic FTP command but it doesn't work.Here is a more reliable method of extracting the date.
@echo off
:: Checking for production cluster
if not exist e: exit
set M=%date:~4,2%
set D=%date:~7,2%
set Y=%date:~10,4%
set target=%Y%%M%%D%
@echo E:\ACHDlrPPcsvDownload\*-%target%*-GMACTEST.csv /y E:\ACHDLRCSV
xcopy E:\ACHDlrPPcsvDownload\*-%target%*-GMACTEST.csv /y E:\ACHDLRCSV
Look at the command being echoed to validate the filename template. Try it at a prompt.
¯\_(ツ)_/¯ -
Add all files of one folder to aperture by running a script
HI,
i have a question:
I will make my Aperture Tethered more easy (with my Canon eos 30D) i have coded a script / folder action to do this but: this folder action does not import all pictures (wy ever, i think that the files coming in to fast were not recognized).
Now i will code a script which will include all files of a folder to aperture when it is run.
i will give it a try, and the import does function, but, i don't know how i can tell the script which files it should import (with a folder action its easy, with this line:
on adding folder items to this_folder after receiving these_items
but how to do this without the "on adding folder items" cause that does not happen in the case i will use it.
i'm looking forward to anthers:D
Best Regards
Christophyes i tryed this application, and there was the same problem as with my one (i have programmed my based on this application)
but both had the same problem they open on imageadd, but if i take more images in seconds (i think the script is still running => it can't recognize new images) it does not recognize the newly taken images.
and i hope some script that imports all images in the folder will solve the problem.
the more ore less only problem is to tell the application which images to import (like: on run import ALL files) -
Power shell script to list all files and folder permissions recursively
Hi All,
I am looking for a powershell script to perform the following operations.
1) To list the folder and file permissions(Allow,Deny both) recursively in a given folder.
2) List out all the files and folders which are having the deny permission or having only the read access (or) only the write access. Basically the folder should have Read,Execute,Write permissions. Else we have to flag that file/folder name.
I had written a batch script for the same which does this task using icacls.exe output, but this script takes lot of time to recursively parse all the files ( ~1 lakh files).
Please help me with the powershell script for the same.
Thanks
SambasivaTry this module: http://gallery.technet.microsoft.com/scriptcenter/PowerShellAccessControl-d3be7b83
After importing the module, you can run something like this:
dir c:\folder -recurse | Get-AccessControlEntry
That output can be exported to a CSV for later viewing. You can also provide some parameters to Get-AccessControlEntry to limit the results:
dir c:\folder -recurse | Get-AccessControlEntry -FileRights Write
dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessDenied
dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessAllowed -FileRights Write -
I need applescript to change all files in a folder and its subfolders ending in .xlsx changed to .xlsb
try something like this:
with timeout of 3600 seconds
-- long timeout to because the Finder is horribly slow
tell application "Finder"
-- collects the files from a folder called "whatever" in your user home folder
set xlsbFiles to every file of entire contents of folder "Whatever" of home whose name extension is "xlsb"
repeat with thisFile in xlsbFiles
set name extension of thisFile to "xlsx"
end repeat
end tell
end timeout
you could make a more efficient script using System Events.app, but this will get the job done with a minimum of thought. -
Hello,
I have a foreach loop in SSIS (as part of Visual Studio 10 and with SQL Server 2012).
It loops over all files in a folder (ForEach File Enumerator).
I set the folder: OK
Traverse Sub folders: OK
I have set up a Variable in Variable Mappings called FileName so it shows User::FileName: OK
Index of variable is 0: OK
It almost works ok. Except that the first file it finds is never considered.
I set a breakpoint then and the first file it finds, is shown in black in the watch variable window. All subsequent files found are shown in red font. When I change the names of the files so another file is the first file found then it skips the other one
which now is the first file.
What is going on here? Why does SSIS skip the first file it finds in a foreach file loop?
Any suggestions highly appreciated.
Thank you
Andi
Andreas"red font - interesting, any example to show us (image)
It would be interesting to share with us whether you use any file masks or expressions.
Arthur
MyBlog
Twitter
It appears a variable value turns red when it changes between breakpoints. It started black for the first value (the first file, obtained BEFORE the execution reached the breakpoint), and then turned red. I was able to reproduce this behavior on a test environment.
However, it did not skip any files.
OP, please set up the test shown in the image below. Create a breakpoint in the sequence container for the "OnPreExecute" event. -
I have been trying to download photos too my MAC. It keeps saying can't create file, please check permissions on destination folder. Ihave made sure I have set the permissions on read and write. What am I doing wrong?
Lanakivee
Try this it worked for me Pat Willener gave it to me off the site :
I have not read all you wrote, so I may have missed some points. As I understand it, you installed FP 10 on IE7, but it won't play any Flash content?
Try this
download the FP uninstaller from http://www.adobe.com/go/tn_14157
close all browser windows, then run the uninstaller
download the offline ActivX installer for Internet Explorer from http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax.exe
close all browser windows, then run the installer -
How to Read all files inside resource Folder inside Jar?
I have a Jar file,,,, The program reads for resource files in the resource folder inside the Jar. I want my program to read all files inside this folder without knowing the names or the number of files in the folder.
I am using this to make an Applet easy to be updated with spicific files. I just want to add a file inside the resource folder and Jar the program and automatically the program reads what ever is in there!!
I used the File class to get all file names inside the resource folder. it works fine before Jarring the program. After I jar I recieve a URI not Herarichy Exception!!
File fold=new java.io.File(getClass().getResource(folder).toURI());
String[] files=fold.list();
I hope the question is clear!!How to get the directory and jar file that you class resides in:
// returns path and jarfile (ex: /home/mydir/my.jar)
public String getJarfileName()
// Get the location of the jar file and the jar file name
java.net.URL outputURL = YourClass.class.getProtectionDomain().getCodeSource().getLocation();
String outputString = outputURL.toString();
String[] parseString;
int index1 = outputString.indexOf(":");
int index2 = outputString.lastIndexOf(":");
if (index1!=index2) // Windows/DOS uses C: naming convention
parseString = outputString.split("file:/");
else
parseString = outputString.split("file:");
String jarFilename = parseString[1];
return jarFilename;
}If your my.jar was in /home/mydir, it will store "/home/mydir/my.jar" in jarFilename.
note: getLocation returns "file:/C:/home/mydir/my.jar" for Windows/DOS and "file:/home/mydir/my.jar" for windows, thus why I look for the first and last index of the colon so I can correctly split the string.
If you want to grab a file in the jar file and get an InputStream, do the following:
import java.io.*;
import java.util.Enumeration;
// jar stuff
import java.util.jar.*;
import java.util.zip.ZipEntry;
public class Jaris
private JarFile jf;
public Jaris(String jarFilename) throws Exception
try
jf = new JarFile(jarFilename);
catch (Exception e)
jf=null;
throw(e);
public InputStream getInputStream(String matchString) throws Exception
ZipEntry ze=null;
try
Enumeration resources = jf.entries();
while ( resources.hasMoreElements() )
JarEntry je = (JarEntry) resources.nextElement();
// find a file that matches this string from anywhere in my jar file
if ( je.getName().matches(".*\\"+matchString) )
String filename=je.getName();
ze=jf.getEntry(filename);
catch (Exception e)
throw(e);
InputStream is = jf.getInputStream(ze);
return is;
// for testing the Jaris methods
public static void main(String[] args)
try
String jarFilename=getJarfileName();
Jaris jis = new Jaris(jarFilename); // this is the string we got from the other method listed above
InputStream is=jis.getInputStream("myfile.txt"); // can be used for xml, xsl, etc
catch (Exception e)
// this is just a test, so we'll ignore the exception
}Happy coding! :)
Doc -
10.6.4: how to unlock all files in a folder
hi,
how do you unlock all files inside a folder?
thank you..thank you.. (I wonder why you can't just do it by getting info on the folder, then saying, unlock all files inside.. (u can do like that in windows) this is always more practical than having to select all files (and accidentally opening them, or something...-) in windows you can select a folder and then say, (un)lock all files and and dirs -- and subdirs and files inside -- inside this folder.. can u do something like this in mac os? if not, that's not very good.. (I guess on the mac would need to find unix commands for doing something like this..)
they really need to consider this for future versions, this is a no-brainer...;-)
thank you.. -
Read all Files from a Folder on Server
Hi,
Can anyone help me in finding if there's any way to read all files in a folder on the server?Any Function module or anything.
ThanksOn App server? Try this sample program.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman -
I'm trying to share a folder between users on a single mac. I want both users to be able to read and write so the folder stays current on both accounts. I put the folder in "shared," set permissions on folder so other user can read and write, enabled file sharing, but can't find the folder on the second user's account. Any help?
Did you log out of one account and into the other or just used Fast user switching?
Is the permissions set to anyone?
When you move data to teh Shared folder is it copied or just moved?
If copied then it's not a folder both can access, just a way station like a USB thumb drive that things are coped too and off of likely.
You can run this #5 on each user account to reset the user permissions once they are taken back out of the Shared folder
Step by Step to fix your Mac -
Windows 2008 R2 Folder assign permission "Read and Write" problem with *.doc file
Hello All,
I am a new one here,
I am sorry for any mistakes and also my english is so poor.
M Brother company runing Windows 2008 R2 as Active Directory...
We have folder Name: Admin
and in this folder, there are alot documents files as : *.doc, *.dwg, *.txt etc.....
All user accesing to these files and they can open to edit and save...
One day my brother want me to set Admin folder for all users just"Read and Write.." mean they still can open files to edit and save... but can't delete..
I did success with this..
But only one thing happen.. when they open *.doc file to edit and attempting to save, the message alert" access denide " and they can only "SAVE AS"...We don't want "Save as"
Could you show me how can we fix error with *.doc file while they trying to save? because it allow only save as.. but other files as *.text file or *.dwg they can save without problem..
Could expert here ever face this issues and fix by yourself, please share me with this..
Please help me..
Best regards,Hi,
Office programs are specific. They will create a temp file when edit, then the temp file will be deleted when close. So Delete permission is needed for users to saving Office files like Excel/Word.
For more detaile information, please refer to the thread below:
Special Permissions - User cannot save files
http://social.technet.microsoft.com/Forums/windowsserver/en-US/721fb2f1-205b-46e5-a3dc-3029e5df9b5b/special-permissions-user-cannot-save-files
Best Regards,
Mandy
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
Maybe you are looking for
-
I used the nifty new Annotate / Add Oval feature in Preview to highlight something of interest in a PDF. The PDF was originally a graphic PNG file, converted to PDF using Save As from Preview. I saved the changes to the PDF and they appear if I open
-
Code Inspector - Object Set Versions
Hello Gurus, Suppose We've created an Obj set (Using Tcode SCI ) say by name "zobjset" (with version 001) and it contains 7 objects (Say) . Subsequntly i've created another Version (Version 002) under same obj set name, and it has 9 objects (Say). N
-
5thGen 80GB Classic Backlight in settings has no arrow no
80GB Classic ipod. Suddenly there is no backlight. I need a flashlight to see what's playing and after having thousands of songs on here, it's just another apple frustrating issue with this ipod. It has been pretty much trouble free, except for a few
-
My flashlight on the LG optimus exceed 2 has stopped working, haven't had this phone not even a month yet. Haven't dropped it in water or dropped it at all
-
I want to use my iMAC as a secondary display
I have a Dell M4500 with displayport connector running Windows 7 Pro. I have a displayport connector on the Dell. I have a displayport to HDMI adapter cable and a HDMI to thunderbolt cable. Can I utilize the iMAC display as a secondary display with t