There is a feature request but the feature is not yet available: https://issues.apache.org/jira/browse/HDFS-199
So, if all files in a dir like "/tmp/" are set to 2 replicas while the default is 3, the new files created in /tmp/ will still have 3 replicas.
To achieve the similar effect, you may need a daemon script to set the replication factors continuously like
while true; do
hdfs dfs -setrep -w 2 /tmp/