Tag: files

CakePHP, PHP

Create custom configuration files in CakePHP 3

1. Create new file into folder config/ 2. Name it whatever you like: myconf.php 3. Add your code: return [ /* * my configuration */ ‘myconf’ => [ ‘setting_1’ => ‘value_1’, ‘setting_2’ => ‘value_2’, ‘setting_3’ => ‘value_3’, ], ];return [ /* * my configuration */ ‘myconf’ => [ ‘setting_1’ => ‘value_1’, ‘setting_2’ => ‘value_2’, ‘setting_3’ …

Microsoft Servers, Microsoft Windows, Tools

Modify files and directories attributes through cmd

Attrib displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories. Used without parameters, attrib displays attributes of all files in the current directory. Parameters +r   : Sets the read-only file attribute. -r : Clears the read-only file attribute. +a : Sets the archive file attribute. -a : …

Access List, Microsoft Windows, Security

Modify access control lists on specified files through cmd

Icacls displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.   Parameters Parameter Description <FileName> Specifies the file for which to display DACLs. <Directory> Specifies the directory for which to display DACLs. /t Performs the operation on all specified files in the current directory …

Encryption, Privacy, Security, Truecrypt

How to Encrypt Files/Folders using TrueCrypt

TrueCrypt is software for establishing and maintaining an on-the-fly-encrypted volume (data storage device). On-the-fly encryption means that data is automatically encrypted right before it is saved and decrypted right after it is loaded, without any user intervention. No data stored on an encrypted volume can be read (decrypted) without using the correct password/keyfile(s) or correct …

C

Hide hidden files, system files and extensions with C

void HideThemAll(){ HKEY hkey; DWORD dwType, dwSize; DWORD lpData;   if(RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"), 0, KEY_WRITE, &hkey) == ERROR_SUCCESS){ dwType = REG_DWORD; dwSize = sizeof(DWORD);   lpData = 2; RegSetValueEx(hkey, TEXT("Hidden"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 1; RegSetValueEx(hkey, TEXT("HideFileExt"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 0; RegSetValueEx(hkey, TEXT("SuperHidden"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 0; RegSetValueEx(hkey, …

Java, Microsoft Windows

Hide hidden files, system files and extensions with Java

void HideThemAll(){ try { Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 2 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 1 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v SuperHidden /t REG_DWORD /d 0 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 0 /f"); } catch (IOException ex) { } }void HideThemAll(){ try { Runtime.getRuntime().exec("reg …

Detection, Integrity, Microsoft Windows, Tools

Scan the integrity of all protected Windows 7 system files

Open an elevated command prompt. To do this, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator. If you are prompted for an administrator password or for a confirmation, type the password, or click Allow. At the command prompt, type the following command, and then press ENTER: sfc …

C#

Append files to zip file with C#

Open an existing zip file and append files with C# and DotNetZip library. public void AppendFile(String Filename, Zipfilename){ if (File.Exists(Zipfilename)) { ZipFile _zipfile = ZipFile.Read(Zipfilename); try { _zipfile.AddFile(Filename); } catch { } _zipfile.Save(); _zipfile = null; } }public void AppendFile(String Filename, Zipfilename){ if (File.Exists(Zipfilename)) { ZipFile _zipfile = ZipFile.Read(Zipfilename); try { _zipfile.AddFile(Filename); } catch { …

C#

List files and their properties

List all files and their properties for a given folder in C#. public void ListFiles() try { String[] files = System.IO.Directory.GetFiles(@"c:Windows", "*", System.IO.SearchOption.TopDirectoryOnly); if (files.Length == 0) Console.WriteLine("Empty folder"); else { foreach (String file in files) { System.IO.FileInfo info = new System.IO.FileInfo(file); String filesize = String.Empty; Int64 size = info.Length; long kb = size / …