public boolean cipherFileOrFolder() throws Exception {

		final String sourceFileOrFolder = commandline.getSourceFileOrFolder();
		long fileCounter = 0;

		File sourcePath = new File(sourceFileOrFolder);

		String targetFileOrFolder = commandline.getTargetFolder();
		OutputStream os = null;

		System.out.println();

		try {

			if (commandline.getCipherMode() == Cipher.ENCRYPT_MODE) {
				/*
				 * Create one wrapper for file names, sizes and permissions, and
				 * one wrapper for the file contents. If no IV and salt are
				 * given they will be generated using the SecureRandom class.
				 */
				createCryptoWrappers(null /* initializationVector */, null /* salt */);

				if (sourcePath.isDirectory()) {

					// Get complete tree of all files and folders in sourcePath
					FolderList folderList = new FolderList(sourcePath.getPath());
					Collection<String> fileTree = folderList.getFilesAsString();
					Collection<String> folderTree = folderList.getFoldersAsString();

					if (fileTree.isEmpty()) {
						logger.severe("Directory '" + sourcePath.getName() + "' is empty", true);
						return false;
					}

					os = openArchiveFileAndWriteHeader(targetFileOrFolder);

					// Walk through all directories and store directory
					// structure in archive.
					for (String relativePath : folderTree) {
						// Encrypt file and add to archive
						encryptAndArchivePath(folderList.getArchiveTopFolder(), relativePath + File.separator, os);
					}

					// Walk through all files
					for (String relativePath : fileTree) {
						// Encrypt file and add to archive
						encryptAndArchivePath(folderList.getArchiveTopFolder(), relativePath, os);
						System.out.println();
						++fileCounter;
					}
				} else {
					os = openArchiveFileAndWriteHeader(targetFileOrFolder);
					String fullPath = FilenameUtils.getFullPath(sourcePath.getAbsolutePath());
					encryptAndArchivePath(fullPath, sourcePath.getName(), os);
					System.out.println();
					++fileCounter;
				}
				os.close();

			} else if (sourcePath.isFile()) {
				fileCounter = decryptArchive(sourcePath.getAbsolutePath(), targetFileOrFolder);
			}

		} catch (Exception e) {
			logger.warning("File ciphering operation failed: " + e.getMessage(), true);
			e.printStackTrace();
			return false;
		} finally {
			if (os != null)
				os.close();
		}

		System.out.println();

		String endText = (commandline.getCipherMode() == Cipher.ENCRYPT_MODE) ? "encrypted" : "decrypted";
		logger.info(fileCounter + " file(s) " + endText, true);

		return true;
	}