Meaning of Depth header in WebDAV PROPFIND method - webdav

I am writing something in PHP to create a virtual file system using WebDAV.
I am trying to get my head around the PROPFIND request method. RFC 4918 mentions something about it, but I’m not sure I understand. Can someone clarify this:
What is the role of the Depth value (0, 1, infinity)? Has it something to do with folders vs files?
Thanks

What is the role of the Depth value (0, 1, infinity)? Has it something to do with folders vs files?
For directories:
Depth 0: Retrieve properties of the directory
Depth 1: as 0 + properties of all files in the directory
Depth infinity: as 1 + properties of all files in sub-directories of the directory (recursively)
For files it has no effect.
The depth applies similarly to other WebDAV methods.

Related

What is proper syntax for wildcard driven filter rules file for rsync?

I am trying to use a filter rules file that uses wildcards for include/exclude lines to drive what gets included and excluded for running rsync to backup a server.
I am using the command line like:
rsync -avzh --filter="merge rsync_backup_filter" / user#backupserver:/backup-data
where rsync_backup_filter is currently something like
+ /var
+ /var/www
+ /var/www/webapp1/***
+ /var/www/webapp2/***
- /var/www/*/repo
+ /home/***
+ /etc/***
- *
but that filter rule syntax above is not quite right because the results don't actually match what I am intending. The repo sub folder is not excluded as I am trying to achieve.
I want to be able to use something like the last entry to say exclude anything not explicitly (using wildcards) included in the rules above
I want to be able to include certain paths (in the example above including webapp paths) and indicate that all files and folders below that point should be included but also be able to add exclusions within that previous wildcard (in the example above I want to exclude the repo subdir in any webapp path, so essentially saying "all except" in certain paths
Above is just a snippet and the longer version of the file would be a full backup strategy for the server from the root on
What is correct way to do structure the filter rules file and proper way to use wildcards to achieve what I've described?
Filter rules constitute an ordered set and evaluation continues until the first match occurs. So, all repo folders will be excluded, if you move the exclude rule up - at least to line #3.

os.walk - counting the directories traversed

I have written a code to traverse directories using the os.walk to search for a specific type of file.
for dirpath, dirnames, files in os.walk(directory):
for name in files:
if name.lower().endswith(".txt"):
print ()
cl += 1
This works perfectly fine for the search but I would like to know if there is a way where I can track the number of directories (dirname) being traversed ? Ex: there are 10 folders containing a .txt file and tracking the no of times dirnames changes I need to get 10 in a counter.
Sorry, I could not find if there was a post about this earlier. If some one can help me track the old post or help with answer for this - that would be fantastic.

Upload file with CMIS Service on st:site

I have been uploading files to Company Home pretty easily with this url:
http://myhost.com:8080/alfresco/s/api/path/workspace/SpacesStore/app:company_home/children
Now I am trying to upload to a folder within a site
http://myhost.com:8080/alfresco/s/api/path/workspace/SpacesStore/app:company_home/st:sites/cm:mysite/children
And keep getting this
Cannot find object for NodePathReference[storeRef=workspace://SpacesStore,path=app:company_home/st:sites/cm:mysite]
Am I missing a special way to declare the path of a site?
i'm not sure how you are uploading to that path but i suppose you need to go into 'documentLibrary' of the site
http://myhost.com:8080/alfresco/s/api/path/workspace/SpacesStore/app:company_home/st:sites/cm:mysite/cm:documentLibrary/children
I found out that there are 6 webscripts related to file manipulation, and it seams each one takes the path in a different way.
I ended up using
http://example.com:8080/alfresco/s/cmis/p/Sites/mySite/Test/children
This particular service it takes Display Names as path segments, and the p itself represents the Company Home segment
I also obtained the same results with this one
http://example.com:8080/alfresco/s/cmis/s/workspace:SpacesStore/i/2aa692bd-0dab-4514-a629-ad36382189f2/children
Which as you can see takes nodeRef Ids as parameter.

Finding out with wxWidgets: Is this a writeable directory?

I have a wxFilenName mydir that should point to a writeable directory. Ultimately, mydir has been obtained via mydir=otherfilename.GetPath() (though via some disgressions maybe). Assuming that mydirrefers to (on a Windows box) C:\foo\bar, I need to ensure that C:\foo\barexists and is a directory (not a file) and I have write permissions (so I might create C:\foo\bar\baz).
What I do is to check mydir.IsOk() && mydir.DirExists() && mydir.IsDirWriteable(), but I suspect this does not do what I want. From reading the wxwidgets docs, I gather that it does distinguish between a wxFileName referencing C:\foo\barin the sense of "the file/dir bar in the directory C:\foo" versus C:\foo\bar in the sense of "the directoy C:\foo\bar and no particular file in it") so that I'd expect my method to work as GetPath()should return such a "pure" directory. However, I suspect (and testing indicates) that my checks really check if C:\foo is a writeable directory ...
What would be a better method (within the wxWidgets framework)? Do I really need to append some dummy filename before performing my checks?
Use wxFileName::DirName() to create an object representing a directory.

Clearcase - Find out when view was created

We have many old snapshot views lying around and I need to find out when these snapshot views were created.
There is a twist - we are no longer running ClearCase and the hardware we used to run it is no longer around. However, we still have all the files used internally by ClearCase still lying around, so I can go to a directory /usr7/viewstore/some_snapshot_sv and poke around.
I've got a timestamp on these directories, but this is not necessarily when the view was created.
I was wondering if somewhere in this directory structure there was a certain file in which I can search for a creation date.
I'm in a Unix/Linux environment. ClearCase did run on IRIX.
Thanks.
Any metadata associated with the view is on the view server side, where the view storage are kept.
The one file which could be the closest from the creation date would be the .hostname file within a view storage.
It is only created and updated on the view creation, and never change unless the view is unregistered, and then re-registered (very rare).
view.dat is also a good candidate (but can also be regenerated, and is for snapshot view only)
This IBM article lists all relevant files:
Files that are regenerated automatically when the view is restarted:
# .access_info
# .pid
Files that can be regenerated with ClearCase commands:
# .compiled_spec -- regenerate by running cleartool setcs -current
# .hostname -- regenerate by unregistering and re-registering the view
# view.dat -- Snapshot views only:
can be regenerated by running the "regen_view_dot_dat.pl" script
found in <cc-home-dir>\etc\utils
See technote1204161 for more details on the regenerating the view.dat file.
Files that can be manually replaced by making a new view on the same machine as the same user, and copying the affected file(s) to the view storage:
# config_spec
# groups.sd
# identity.sd
# view_db.state (as long as the view is not in the process
of being reformatted); see technote 1134858 for more information
# db/view_db.dbd (for schema 9 views only; 2002.05.00 and earlier)
# db/view_db_schema_version
# .view - The copy obtained from the new view must be edited to contain the correct information for the old view as described below. The correct information can be obtained from the output of "cleartool lsview -long <old_viewtag>".
Line 1: the location of the view storage directory, in hostname:pathname format
Line 2: the view's UUID (unique identifier), which must not be changed
Line 3: the hostname specified in line 1
Files that cannot be replaced:
# All other files in the db directory except the ones mentioned above
( view_db_schema_version and view_db.dbd)
If you use cleartool, I think you may try it this way:
cleartool lsview -properties [view-name]
* [view-name] /net/...[path]
Created 2014-01-07T18:05:15+02:00 by ...
Last modified 2014-01-07T21:13:07+02:00 by .....
Last accessed 2014-01-07T21:13:07+02:00 by .....
Owner: [owner-name] : rwx (all)
Group: [group-name] : r-x (read)
Other: : r-x (read)

Resources