Get folder properties or info
Does anyone know how to access a folder's properties (eg.
size, modified, date, etc). I have 2500 jpg files within a folder
and would like to know if the folder has been updated in any way
instead of checking all 2500 files using something like buddyAPI's
baFileDate().
Many thanks in advance / RP
Pangy (London) wrote:
> Does anyone know how to access a folder's properties
(eg. size,
> modified, date, etc). I have 2500 jpg files within a
folder and would
> like to know if the folder has been updated in any way
instead of
> checking all 2500 files using something like buddyAPI's
baFileDate().
Checking all the files will not take very long. I would not
trust a folder's
properties to check on its contents.
Andrew
Similar Messages
-
How do I change Desktop folder properties?
I recently purchased a macbook pro. I used migration assistant to transfer all files, from my g4, via firewire. Now, when I attempt to download from the internet, I get this error message: "Downloading/users/myname/Desktop/filename could not be saved, because you cannot change the contents of that folder. Change the folder properties and try again, or try saving in a different location". How do I change desktop folder properties?
mac book pro Mac OS X (10.4.7)Control-click or right-click anywhere on your desktop picture, and select Get Info from the contextual menu. Then expand the Ownership & Permissions section. You need to set the drop-down menus like this:
You can: Read and Write
Owner: <your username>
Access: Read & Write
Group: Staff
Access: No Access
Others: No Access
If that doesn't work, log in as an administrator, open Terminal, and enter these commands (assuming your username is "bigalive"; change appropriately:
sudo chown bigalive:staff /Users/bigalive/Desktop
sudo chmod 700 /Users/bigalive/Desktop
That should fix it. -
SSIS 2012 Script Task to Get File Properties
Hello,
I researched on how to grab a file properties such as file size, file modified date, etc and I came across the following
link:
I followed exact steps and when I went to execute the package, I got the following error:
Below is the code:
// C# code
// Fill SSIS variables with file properties
using System;
using System.Data;
using System.IO; // Added to get file properties
using System.Security.Principal; // Added to get file owner
using System.Security.AccessControl; // Added to get file owner
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_cb8dd466d98149fcb2e3852ead6b6a09.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
public void Main()
// Lock SSIS variables
Dts.VariableDispenser.LockForRead("User::FilePath");
Dts.VariableDispenser.LockForWrite("User::FileAttributes");
Dts.VariableDispenser.LockForWrite("User::FileCreationDate");
Dts.VariableDispenser.LockForWrite("User::FileExists");
Dts.VariableDispenser.LockForWrite("User::FileInUse");
Dts.VariableDispenser.LockForWrite("User::FileIsReadOnly");
Dts.VariableDispenser.LockForWrite("User::FileLastAccessedDate");
Dts.VariableDispenser.LockForWrite("User::FileLastModifiedDate");
Dts.VariableDispenser.LockForWrite("User::FileOwner");
Dts.VariableDispenser.LockForWrite("User::FileSize");
// Create a variables 'container' to store variables
Variables vars = null;
// Add variables from the VariableDispenser to the variables 'container'
Dts.VariableDispenser.GetVariables(ref vars);
// Variable for file information
FileInfo fileInfo;
// Fill fileInfo variable with file information
fileInfo = new FileInfo(vars["User::FilePath"].Value.ToString());
// Check if file exists
vars["User::FileExists"].Value = fileInfo.Exists;
// Get the rest of the file properties if the file exists
if (fileInfo.Exists)
// Get file creation date
vars["User::FileCreationDate"].Value = fileInfo.CreationTime;
// Get last modified date
vars["User::FileLastModifiedDate"].Value = fileInfo.LastWriteTime;
// Get last accessed date
vars["User::FileLastAccessedDate"].Value = fileInfo.LastAccessTime;
// Get size of the file in bytes
vars["User::FileSize"].Value = fileInfo.Length;
// Get file attributes
vars["User::FileAttributes"].Value = fileInfo.Attributes.ToString();
vars["User::FileIsReadOnly"].Value = fileInfo.IsReadOnly;
// Check if the file isn't locked by an other process
try
// Try to open the file. If it succeeds, set variable to false and close stream
FileStream fs = new FileStream(vars["User::FilePath"].Value.ToString(), FileMode.Open);
vars["User::FileInUse"].Value = false;
fs.Close();
catch (Exception ex)
// If opening fails, it's probably locked by an other process
vars["User::FileInUse"].Value = true;
// Log actual error to SSIS to be sure
Dts.Events.FireWarning(0, "Get File Properties", ex.Message, string.Empty, 0);
// Get the Windows domain user name of the file owner
FileSecurity fileSecurity = fileInfo.GetAccessControl();
IdentityReference identityReference = fileSecurity.GetOwner(typeof(NTAccount));
vars["User::FileOwner"].Value = identityReference.Value;
// Release the locks
vars.Unlock();
Dts.TaskResult = (int)ScriptResults.Success;
Eventually I am looking to just grab the Modified Date from the Windows Explorer folder and insert into table. Any suggestions? Thank you in advance!
Sanjeev
Sanjeev JhaHi SSISJoost,
I am so glad you responded to this thread. You are absolutely right. I copied the entire code including the project name (guid) and that solved the error problem.
Now, what did you do to get the message box? I added the watch and I could see the values but how do I get these values in a table? If I remember correctly, in your blog, you mentioned something about using derived columns. I am familiar with Derived Columns
but how do I do that? I appreciate your response.
Thank you.
Sanjeev
Sanjeev Jha
I used a second script task to show all variable values. It has a
MessageBox in it and between all
variables I added a
newline to make it more readable...
But with an Execute SQL Task and parameters you can also put these values in a Table... or you can read the file in a Data Flow Task and add those variables (as metadata) to each record with a Derived Column
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter -
Hi All,
I need to retrieve the folder name for where the item is stored to generate a report in following format in csv
File Name Full Path Parent Folder Created By Last Modified By Number of Versions Total Size
My code which gets all other info.
function Get-DocInventory() {
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site=Get-SPSite -Identity "siteURL"
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
if ($list.BaseType -ne "DocumentLibrary") {continue}
foreach ($item in $list.Items) {
$data = @{
# "Web Application" = $webApp.ToString();
#"Web" = $web.Url
"Site" = $site.Url
"list" = $list.Title
"Item ID" = $item.ID
"Item URL" = $site.Url+"/"+$item.Url
"Item Name"= $item.File.Name
“Item Versions” = $item.Versions.Count
"Item Created" = $item["Created"]
"Extensions" = $item.name.split(".")[1]
"Item Modified" = $item["Modified"]
"Item Created By" = $item["Author"]
"Last Updated by" = $item["Editor"]
"File Size" = $item.File.Length/1KB
New-Object PSObject -Property $data
$web.Dispose();
$site.Dispose()
#Get-DocInventory | Out-GridView
Get-DocInventory | Export-Csv -NoTypeInformation -Path D:\Scripts\Hemant\inventory.csv
Coukld you please help me get folder name
Thanks BasvaTo get the full Folder URL you could use:
$item.File.ParentFolder.Url
And just for the Folder Name use:
$item.File.ParentFolder.Name -
Code for setting KM Folder properties(standard & custom)
Hi,
How do I programatically set the KM Folder properties(standard as well as custom defined) ?
Also, how do I programatically set KM Document properties(standard & custom) and its Permissions ?
(I have NWDS setup to do the development)
Any API references or code samples or documentation would be of great help
thanks
AshishYou could do something like this...
path is the location of the resource in KM.
namespace is the namespace of the property you would like to set.
name is the id of the property you would like to set.
value is what you want to set it to.
public static boolean setPropertyValueOfResource(String path, String namespace, String name, String value)
try
RID file = RID.getRID(path);
IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext rContext = new ResourceContext(user);
IResource fileResource = ResourceFactory.getInstance().getResource(file, rContext);
IPropertyName pName = new PropertyName(namespace, name);
IProperty prop = new Property(pName, value);
fileResource.setProperty(prop);
return true;
catch(NullPointerException E)
catch(UserManagementException e)
catch(ResourceException e)
You can also get the property value of a resource.
public static String getPropertyValueOfResource(String path, String namespace, String name)
try
RID file = RID.getRID(path);
IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext rContext = new ResourceContext(user);
IResource fileResource = ResourceFactory.getInstance().getResource(file, rContext);
IPropertyName pName = new PropertyName(namespace, name);
IProperty property = fileResource.getProperty(pName);
return property.getValueAsString();
catch(NullPointerException E)
catch(UserManagementException e)
catch(ResourceException e)
You can also get the available values for the property
public static String[] getAllowedPropertyValues(String propertyId, String namespace)
try
IPropertyConfigurationService propConfigService =(IPropertyConfigurationService)ResourceFactory.getInstance().getServiceFactory().getService("PropertyConfigurationService");
IMetaModel metaModel = propConfigService.getMetaModel();
IPropertyName propertyName = new PropertyName(namespace, propertyId);
IMetaName metaName = metaModel.searchByPropertyName(propertyName);
IMetaValueListIterator iterator = metaName.allowedValueIterator();
String values = "";
while(iterator.hasNext())
IMetaValue m = iterator.next();
values += m.getValue() + ";";
return values.split(";");
catch (ResourceException e)
catch (PropertyConfigurationServiceException e) -
Movie/Get Movies Properties Menus
Hello,
Wanted to ask is there a difference with Quicktime Pro 7 between a PC and Mac? I run a PC with Quicktime Pro 7 I am working on a web course for audio and video and my instructor wrote in the instructions to click on the Movie/Get Movies Properties menus and then from there selcting Sound Track and then click on General from the two drop down menus.
All I have in mine is when the file is opened to click on the Window Menu and then click on the Show Movie Info menu to record the data such as data size and data rate. As I am doing some analyzing on various codecs and audio formats to see if the file will or will not retain their sound quality when compressed at various rates. So for me is this how it is for the PC? I see that it records the data rate and data size in KB don't know wheather it's kilobytes per second or kilobits per second for the data rate. As for the data size shows KB I would think that's kilobytes but my instructor wants me to write it in the form as an example 111.1k looks I might have to convert.
Any help or feedback would be greatly appreciated.
Thanks alot,
RyanSuggest you try importing your movies with free OPlayerHD Lite via iTune File Sharing.
https://itunes.apple.com/sg/app/oplayerhd-lite-best-free-video/id385896088?mt=8 -
Get-adgroup get-adgroupmember properties
Looking to combine 2 commands for csv output.
For every mail enabled group I need to pull Name, Members, Memberof, whencreated, Info, managedby
This gets the data but I want memberof and members in a format that an auditor can use.
get-adgroup -Filter {Proxyaddresses -Like "*"} -properties * | ft Name, Members, Memberof, whencreated, Modified, Managedby, info
how can I get the members and memberof in a first name last name format for members and a display name format for memberof?
Thanks muchHi,
Use a calculated property:
Get-ADGroup -Filter "ProxyAddresses -like '*'" -Properties Members,MemberOf,WhenCreated,Modified,ManagedBy,info |
Select Name,
@{N='Members';E={ ($_.Members | % { (Get-ADUser $_).Name } | Sort) -join ', ' }},
@{N='MemberOf';E={ ($_.MemberOf | % { (Get-ADGroup $_ -Properties DisplayName).DisplayName } | Sort ) -join ', ' }},
WhenCreated,
@{N='ManagedBy';E={ $_.ManagedBy | % { (Get-ADUser $_).Name } }},
Info |
Sort -Property Name |
Export-Csv .\groupInformation.csv -NoTypeInformation
This uses the Name property for the group members, you can adjust that if needed.
http://technet.microsoft.com/en-us/library/ff730948.aspx
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
Need To Get Folder and Subfolders List
Hi All
I have a requirement which will give me the list of folder and subfolders list for a given path. I can achieve this using xp_cmdshell.
But it is admin level usage. So i need to get with the use SP_OAMethod using file system object.
Please help me to do the same.Hello Amarnath, Finally i have the code that you are looking for.
SELECT * FROM dbo.dir('c:\testfolder') WHERE IsFolder =1
--------------- USER DEFINE FUNCTION
CREATE FUNCTION [dbo].[Dir](@Wildcard VARCHAR(8000))
RETURNS @MyDir TABLE
-- columns returned by the function
[name] VARCHAR(2000), --the name of the filesystem object
[path] VARCHAR(2000), --Contains the item's full path and name.
[ModifyDate] DATETIME, --the time it was last modified
[IsFileSystem] INT, --1 if it is part of the file system
[IsFolder] INT, --1 if it is a folsdder otherwise 0
[error] VARCHAR(2000) --if an error occured, gives the error otherwise null
AS
-- body of the function
BEGIN
DECLARE
--all the objects used
@objShellApplication INT,
@objFolder INT,
@objItem INT,
@objErrorObject INT,
@objFolderItems INT,
--potential error message shows where error occurred.
@strErrorMessage VARCHAR(1000),
--command sent to OLE automation
@Command VARCHAR(1000),
@hr INT, --OLE result (0 if OK)
@count INT,@ii INT,
@name VARCHAR(2000),--the name of the current item
@path VARCHAR(2000),--the path of the current item
@ModifyDate DATETIME,--the date the current item last modified
@IsFileSystem INT, --1 if the current item is part of the file system
@IsFolder INT --1 if the current item is a file
IF LEN(COALESCE(@Wildcard,''))<2
RETURN
SELECT @strErrorMessage = 'opening the Shell Application Object'
EXECUTE @hr = sp_OACreate 'Shell.Application',
@objShellApplication OUT
--now we get the folder.
IF @HR = 0
SELECT @objErrorObject = @objShellApplication,
@strErrorMessage = 'Getting Folder"' + @wildcard + '"',
@command = 'NameSpace("'+@wildcard+'")'
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objShellApplication, @command,
@objFolder OUT
IF @objFolder IS NULL RETURN --nothing there. Sod the error message
--and then the number of objects in the folder
SELECT @objErrorObject = @objFolder,
@strErrorMessage = 'Getting count of Folder items in "' + @wildcard + '"',
@command = 'Items.Count'
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objfolder, @command,
@count OUT
IF @HR = 0 --now get the FolderItems collection
SELECT @objErrorObject = @objFolder,
@strErrorMessage = ' getting folderitems',
@command='items()'
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objFolder,
@command, @objFolderItems OUTPUT
SELECT @ii = 0
WHILE @hr = 0 AND @ii< @count --iterate through the FolderItems collection
BEGIN
IF @HR = 0
SELECT @objErrorObject = @objFolderItems,
@strErrorMessage = ' getting folder item '
+ CAST(@ii AS VARCHAR(5)),
@command='item(' + CAST(@ii AS VARCHAR(5))+')'
--@Command='GetDetailsOf('+ cast(@ii as varchar(5))+',1)'
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objFolderItems,
@command, @objItem OUTPUT
IF @HR = 0
SELECT @objErrorObject = @objItem,
@strErrorMessage = ' getting folder item properties'
+ CAST(@ii AS VARCHAR(5))
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objItem,
'path', @path OUTPUT
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objItem,
'name', @name OUTPUT
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objItem,
'ModifyDate', @ModifyDate OUTPUT
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objItem,
'IsFileSystem', @IsFileSystem OUTPUT
IF @HR = 0
EXECUTE @hr = sp_OAMethod @objItem,
'IsFolder', @IsFolder OUTPUT
--and insert the properties into a table
INSERT INTO @MyDir ([NAME], [path], ModifyDate, IsFileSystem, IsFolder)
SELECT @NAME, @path, @ModifyDate, @IsFileSystem, @IsFolder
IF @HR = 0 EXECUTE sp_OADestroy @objItem
SELECT @ii=@ii+1
END
IF @hr <> 0
BEGIN
DECLARE @Source VARCHAR(255),
@Description VARCHAR(255),
@Helpfile VARCHAR(255),
@HelpID INT
EXECUTE sp_OAGetErrorInfo @objErrorObject, @source OUTPUT,
@Description OUTPUT, @Helpfile OUTPUT, @HelpID OUTPUT
SELECT @strErrorMessage = 'Error whilst '
+ COALESCE(@strErrorMessage, 'doing something') + ', '
+ COALESCE(@Description, '')
INSERT INTO @MyDir(error) SELECT LEFT(@strErrorMessage,2000)
END
EXECUTE sp_OADestroy @objFolder
EXECUTE sp_OADestroy @objShellApplication
RETURN
END---- OUTPUT
Regards, RSingh -
How to get folder(directory path only not file path) from local file system
Hi Firends,
How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
Please give reply for this one , if anybody knows.
Thanks,
Anderson.Hi Anderson,
if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
(so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
hth,
kind regards,
Peter -
Installed new hard drive in imac and i get folder with question mark, put in OS install disk and it does nothing? All I have is wireless key board and mouse, is this an issue?
Other than put disc in you don't give much info about what you've done. With the install disc inserted restart your Mac while holding the C key, that should start it up from the install disc. Should also work fine with a wireless Apple keyboard.
-
I am trying to get the size of a folder I used:
Set Archive to "Martha:EyeTV Archive"
Set ASize to size of (info for Archive)
I get and error on "info for Archive" saying it can find the file. This is a folder not a file. Do I have to use a shell script:
Set ASize to word 1 of (do shell script "/usr/bin/du -ks" & quoted form of (POSIX path of (Archive as string)))By the way, since the Standard Additions scripting dictionary describes the “info for” command as deprecated, maybe you'd better use the following code:
set Archive to POSIX file "/Volumes/Martha/EyeTV Archive" as alias
tell application "System Events" to set ASize to size of Archive
You could also ask for the “physical size” property of the Archive folder. -
How to get all properties for an item with search?
How can I get all crawled / managed properties back of an item with the search API (REST, client, or server)?
Currently I am only aware of specifying the applicable properties specifcally by using the selectproperties parameters via REST:
http://host/site/_api/search/query?querytext='terms'&selectproperties='Path,Url,Title,Author'
(taken from http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx)
I don't want to do this. I just want to get all properties back that
are associated with the search results.Its my understanding that standard managed properties will be returned, like: Created Date, Last Date Modified, Author, Title, etc. However, if you need more than that you will need to specify the properties to return.
This blog post also has a similar thought process:
http://www.blendmaster.net/blog/2012/09/view-managed-property-value-in-sharepoint-2013-using-search-rest-api/
Brandon Atkinson
Blog: http://brandonatkinson.blogspot.com -
how can i get my user manual info back onto my settings menu
this heading did not appear on the settings menu following a restore necessitated bt a freezing screen glitch thanksI'm not entirely sure what you are referring to, there isn't a user manual section in the iPad's Settings app. If you want an iPad then you can either download it from here : http://support.apple.com/manuals/ipad/
Or if you download the iBooks app then there should be a copy in the ibookstore in it -
I recently got a new iphone but when I restored it in iTunes one of my games that I have played for months RESET. How do I get my old game info back?
If you made a backup before you restored it you can restore your iPhone from a backup and your game data should be restored. When you connect your iPhone in iTunes you can right click on it in the sidebar and select restore from backup.
-
How to get Folder Location by just providing folder name ?
Hi,
I want to get folder location by providing its name.
I created one folder on "E:\" drive and when I used following code in netbeans it giving me the current loaction of java file.
File directory = new File("SVN");
boolean isDirectory = directory.isDirectory();
if (isDirectory) {
// It returns true if directory is a directory.
System.out.println("the name you have entered is a directory : " + directory);
//It returns the absolutepath of a directory.
System.out.println("the path is " + directory.getAbsolutePath());
else {
// It returns false if directory is a file.
System.out.println("the name you have entered is a file : " + directory);
//It returns the absolute path of a file.
System.out.println("the path is " + directory.getAbsolutePath());
}And i got following output
the name you have entered is a file : SVN
the path is C:\Users\AjayS\Documents\NetBeansProjects\TestCodes\SVNBut my folder is located on "E:\" drive.
Regards,
AjayYou will have to search for them. But that indicates something seriously wrong with the requirement. In effect you're using the local filename as a secondary key but there is no index on it. You should consider a database.
Maybe you are looking for
-
FAGLB03 peroid balance not tallying with line items within
Hi, When i go to FAGLB03 and tally the balance of a recon account for a particular month with the line items in it, it does not tally This is happening for one period within the fiscal year, others period balance tally with the line items What can b
-
I am transfering the data from Mysql database to Oracle 11gR2. I using a control table( here temp_tab ) to maintain the details of the source and target table and dblink info. Also p1 is the procedure used for data transfer. My problem is 1) I am not
-
Error while trying to send Fax
Hi experts, I am trying to send FAX from my SAP report , i am seeing an error in SOST as 'Message cannot be transferred to node FAX100 due to connection error(Final). Can any one help me to sort it out. Regards, Ratheesh BS
-
BufferToImage does'nt support YUY2 VideoFormat ?
I have USB Aver Meadia Capture Card. It supports only YUY2 VideoFormat. JMF has found that device. VideoFormat rgbf = (VideoFormat)camStream.getFormat(); BufferToImage btoi = new BufferToImage(rgbf); g.drawImage(btoi.createImage(buf),0,0,null);
-
Google Calendar (gCal) and the iPhone - is this even possible
Is it possible for me to configure gCal to work with the iPhone Calendar application? Are there any restrictions (I.e. view only, etc?) Much thanks in Advance! -Sig