AttributeBits, ValidAttributeBits, etc.

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
2BrightSparks
Posts: 44
Joined: Thu Feb 23, 2006 5:41 am

AttributeBits, ValidAttributeBits, etc.

Post by 2BrightSparks » Mon Jan 03, 2011 1:07 pm

At the moment I'm upgrading from V1.5 to V2 and am confused about the attribute bits settings in the new V2. Using SFTP, could you give me an example of setting a files last modification date & time and also how to remove a read-only attribute from a file? Previously I used AttributeBits, ValidAttributes, and ValidAttributeBits, but now I see that ValidAttributes no longer exists, and neither do the definitions like ftpSFTPItemAttributeBitReadOnly etc.

Thanks

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: AttributeBits, ValidAttributeBits, etc.

Post by mb » Mon Jan 03, 2011 2:37 pm

>setting last modification time
Create new SFTPItem:
CComPtr<sfFTPLib::ISFTPItem> pItem;
pItem.CoCreateInstance(__uuidof(sfFTPLib::SFTPItem));
Set LastModifyTime
pItem->ModifyTimeAsFileTime = FILETIME;
pSFTPConnection->SetStat("path", pItem)

To check if an attribute exists use IsValidAttribute.
pItem->IsValidAttribute(sfFTPLib::ftpSFTPItemAttributeBits)

>ftpSFTPItemAttributeBitReadOnly etc
Please install the newest version.

>To remove attributebitreadonly
Create new SFTPItem
pNewItem->AttributeBits = pItem->AttributeBits & ~sfFTPLib::ftpSFTPItemAttributeBitReadOnly;
SetStat("path", pNewItem);

Post Reply